Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cols= ["ctype", "cbid", "fname", "sname", "oname", "dob", "gender", "schoolid", "class", "address1", "address2", "postcode", "county", "intfolder", "extfolder", "therapist", "team", "dor", "status", "status2", "lastupdate", "updateby"] ##cant get this from csv yet
- data = [] ##empty list for dictionaries
- with open('clients.csv', mode='r') as f: ##csv file
- rows = csv.reader(f)
- for row in rows:
- mydict = {}
- for i in range(len(cols)):
- mydict[cols[i]] = row[i] ##creates the dictionary from the manual columns
- data.append(mydict) ##appeds it to the data list
- for dict in data:##cycle through the dictionries
- cur = DB.cursor()
- qmarks = ', '.join('?' * len(dict))
- qry = "Insert Into Table (%s) Values (%s)" % (qmarks, qmarks)
- myquery = (qry, dict.keys() + dict.values()) ##Error Here
- cur.execute(myquery)
- DB.commit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement