Home > database >  Python generated username into the sqlite placeholder mistakes for great god answers
Python generated username into the sqlite placeholder mistakes for great god answers

Time:09-30

Import the random
The import sqlite3

Conn=sqlite3. Connect (' 2 db)
Print (" the Opened the database successfully ")

Cursor=conn. Cursor ()

Cursor. The execute (" CREATE TABLE IF NOT EXISTS CODE (ID int (255) NOT NULL, PRIMARY KEY, ERANDOMCOD VARCHAR (20) NOT NULL, the STATUS int (1) NOT NULL) ")

STR='
Char='AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789'
Length=len (char)
For keys in range (100) :
In the range for v (10) :
STR +=the random choice (char)

# insert record
Cursor. The execute (" INSERT INTO CODE (ID, ERANDOMCOD, STATUS) VALUES (' % s', '% s',' % s') ", [keys, STR, 1])
STR='

MIT ()
conn.com
Then no matter how to change, there will be mistakes, as follows:
Traceback (the most recent call last) :
The File "D:/coursework/9. Py", line 44, in & lt; module>
Cursor. The execute (" INSERT INTO CODE (ID, ERANDOMCOD, STATUS) VALUES (' % s', '% s',' % s') ", [keys])
Sqlite3. ProgrammingError: Incorrect number of bindings supplied. The current statement USES zero, and there are 1 supplied.
The Opened the database successfully

Process finished with exit code 1
  • Related