Question : What is the best way to remove unicode character from  a tuple in Python w/Sqlite?

When I execute a select on a sqlite database, the returning data has a u'.  It returns a tuple like ([(u'ATT',), (u'TIER',), (u'TIO',)].  How can I get it into a list like ('ATT',, 'TIER', 'TMO')?

Answer : What is the best way to remove unicode character from  a tuple in Python w/Sqlite?

The encode() method of a string (http://docs.python.org/library/stdtypes.html#str.encode) will change the encoding from unicode to ascii.  

Your parens don't match so it's hard to tell what you've really got there.  Assuming the opening paren is something you added it looks like a list of tuples.  If that's the case,

1:
2:
3:
4:
5:
6:
7:
origlist=[(u'ATT',), (u'TIER',), (u'TIO',)]
newlist = []
for tup in origlist:
    newlist = newlist + [item.encode('ascii','backslashreplace') for item in tup]

print newlist
Random Solutions  
 
programming4us programming4us