vendredi 6 mars 2015

Remove unicode in Python from databse?

I have a Flask website and I want to assign lists of values from an SQLite3 table to a variable. I managed to do this however every item in the list displays the value like this: [u'Chemistry'] however I just want it to display 'Chemistry'.


Here is my code:



cur = g.db.execute("SELECT DISTINCT subject FROM questions")
subjectList = [list(row) for row in cur.fetchall()]


I looked for answers which included using str() around row to convert into a string and changing the type of the value's column to Blob but neither work. How would I solve this? Thanks.


Aucun commentaire:

Enregistrer un commentaire