from cs50 import SQL, get_string
from sys import argv
import csv
db = SQL("sqlite:///students.db")
if (len(argv) != 2):
exit()
with open(argv[1],"r") as inp:
reader = csv.DictReader(inp)
for row in reader:
lis = row["name"].split
if (len(lis) == 2):
db.execute("INSERT INTO students (name, house, birth) VALUES (list[0], NULL, list[1]")
else:
db.execute("INSERT INTO students (name, house, birth) VALUES (list[0], list[1], list[2]")
I wish to store the split strings in a list, but I get this error. TypeError: object of type 'builtin_function_or_method' has no len()