import sqlite3
import datetime
DT_Now = datetime.datetime.now()
Today = "{}{}{}".format(DT_Now.year, DT_Now.month, DT_Now.day) information = sqlite3.connect("info.db") curs = information.cursor()
def CreateTable():
curs.execute("CREATE TABLE IF NOT EXISTS {}(number TEXT NOT NULL, name TEXT NOT NULL, howMuch INTEGER DEFAULT 0)".format(Today))
CreateTable()
Error: curs.execute ("CREATE TABLE IF NOT EXISTS {} (number TEXT NOT NULL, name TEXT NOT NULL, how Much INTEGER DEFAULT 0)"format(Today)) sqlite3.OperationalError: near "2022418": syntax error
I looked it up, but it doesn't come out well. What's wrong with this?
sqlite python-2.7
I think the problem is the table name consisting of only numbers.
© 2024 OneMinuteCode. All rights reserved.