Answer the question
In order to leave comments, you need to log in
Why, when writing data to a cell, does it treat this data as a column name?
sqlite3.OperationalError: no such column: 9500.
That is, the variable str(result2).replace('\'','') is treated as a column name. And not as data to be written.
for item in result23:
cur.executescript("""INSERT INTO result ('#','number','target_1', 'target_2','bet_size','payot')
VALUES (
"""+str(count_for)+""","""+item+""","""+str(result2).replace('\'','')+""","""+str(result3)+""","""+str(result4)+""","""+str(result5)+""");""")
count_for += 1
Answer the question
In order to leave comments, you need to log in
First, what type is result23? And what is result2?
Second, don't allow more than 80 characters per line. This is very inconvenient to read.
Thirdly:
for count, item in enumerate(result23):
...
for count, item in enumerate(result23):
cur.executescript(
"""INSERT INTO result """
"""('#','number','target_1', 'target_2','bet_size','payot') """
"""VALUES (""" +
",".join((str(count), item, str(result2).replace('\'',''),
str(result3), str(result4), str(result5))) +
");"
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question