Python: Proper way to store list of strings in sqlite3 or mysql
mysql, python, sqlite
Solution
Use a proper serialization mechanism such as JSON, and store it in a text field.
>>> json.dumps(['please','help','me'])
'["please", "help", "me"]'
>>> json.loads('["please", "help", "me"]')
[u'please', u'help', u'me']
Problem
I'm trying to store a list of string values into a sql database. ``` list = ['please','help','me'] ``` I've tried converting to unicode and using the array.array('u',list) ``` unicode_list = unicode(list) array.array('u', list) ``` This is not producing the results that I want. I'm not too concerned with being able to search the value once inserted in the database. Lastly, I'm not looking to use a NOSQL alternative as this time. Any help would be greatly appreciated. Thanks in advance.