Answer the question
In order to leave comments, you need to log in
How to transfer a tuple with variables to sqlite3?
I'm trying to transfer a list consisting of variables into a sqlite3 table, I found out that this can be done using JSON, but when converting string type variables to JSON and outputting them, they are represented in a numeric format. How can I fix this or are there other options for transferring a list / tuple with variables to the database?
mylist = [str(today),categor,name,count,summa]
print(mylist)
js = json.dumps(mylist)
print(js)
Answer the question
In order to leave comments, you need to log in
Add ensure_ascii=False to dumps(...).
But as for me, storing a list in a relational database (including in the form of json) is a violation of the first normal form (see normalization ) and .
You need to either use nosql databases, which is 99% unjustified, or redesign the database so that each value is stored on a separate line.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question