This is not sqlite specific, but it I wondered while learning python and sqlite3 and listing the results of query. I have simple code:
connection = sqlite3.connect("db.sqlite")
cursor = connection.cursor()
cursor.execute("select * from db")
print cursor.fetchall()
So, the results of the print cursor.fetchall()
is: [(u'koko',), (u'lolo',)]
But, when I try to recreate that kind of print with this code:
i=["koko","lolo"]
print i
the print result is: ['koko', 'lolo']
Two things I don't understand:
(u'koko',)
when printing and second doesn't?Is the first list a list of tuples maybe?
[(u'koko',), (u'lolo',)]
is a list of 1-element tuples of unicode strings.
["koko","lolo"]
is a list of byte strings.