import sqlite3
class class1:
def __init__(self):
self.print1()
def print1(self):
con = sqlite3.connect(\'mydb.sqlite\')
cur = con.cursor()
cur.execute(\"
The u
prefix indicates that the string is an Unicode string. If you're sure that the string is a basic ASCII string, you can transform the unicode string into a non-unicode one with a simple str()
.
Example :
unicode_foo = u"foo"
print unicode_foo
>>> u"foo"
print str(unicode_foo)
>>> "foo"
In your case, with a list of tuples, you'll have to do such with a python list comprehension :
ar = [[str(item) for item in results] for results in cur.fetchall()]
Where results
is the list of tuples returned by fetchall
, and item
are the members of the tuples.