Down below is my code my why i don't know their is a problem in it can someone help me out
THIS IS THE ERROR MESSAGE
python3: can't open file 'import.py': [Errno 2] No such file or directory
from cs50 import SQL
from sys import argv
import csv
# checking if code is executed properly else exit
if len(argv) < 2:
print("usage error, import.py characters.csv")
exit(1)
# Open the database for later reuse
db = SQL("sqlite:///students.db")
def division_title(initial):
n = initial.split()
if len(n) == 3:
return n
else:
[n[0],None,n[1]]
with open(argv[1]) as csvfile:
for row in csv.DictReader(csvfile):
n = division_title(row["name"])
db.execute("INSERT INTO student VALUES (?, ?, ?, ?, ?)",
n[0],n[1],n[2],row["house"],row["birth"]
)
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.