How does python sqlite3 store the dictionary in the database.

ps:搞了好久,字典怎么也存不到数据库里.后来请教了师傅,说把字典json序列化一下就行可以保存了.(sqlite3和mysql其实是一样的有些方面).

dict = {'name':'镜中隐', 'age':27, 'address':'杭州'}
dict_xu = json.dumps(dict)
dict = dict()
dict['ID'] = str(dict_xu)
insertSqlite3table2(dict)

There is no error in the table inserted into the database. As long as the dictionary is serialized with json, it is converted into str format and written into the Text type database

 

 

Guess you like

Origin blog.csdn.net/qq_36401512/article/details/90270112