I have a syntax problem using sqlite3 with Python around the last line of the below code:
playerName = input("Enter your name: ")
money = input("Enter credits: ")
conn = sqlite3.connect("highscore.db")
c = conn.cursor()
c.execute("CREATE TABLE players(name TEXT, money INTEGER)")
c.execute("INSERT INTO players VALUES('%s','%s')", playerName, money)
How can I resolve this ?
Change this line:
c.execute("INSERT INTO players VALUES('%s','%s')", playerName, money)
To:
c.execute("INSERT INTO players VALUES(?,?);",(playerName, money))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.