Skip to content
Advertisement

Why sql query extract other info

I want get city attribute from my database. But when I run my code I get this info (u'Rome',) I want get only Rome as result

This is my code

Why do I get this (u'Rome',) result and not only Rome?

Thanks

Advertisement

Answer

Every record in the returned list is represented by a tuple even if There is only one column, to access the column use its index:

Or unpack the tuple to variables:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement