Apr-14-2019, 07:11 PM
Well, in general you would have some validation functions that return True is the name is valid, or False if it isn't. Then you would test on those before entering into the database:
file = askopenfilename(parent = root) if file.endswith('.csv'): with open(file, 'r') as names: toDB = [] reading = csv.DictReader(names) for line in reading: if valid_name(line['Name']) and valid_surname(line['Surname']): toDB.append((i['Name'], i['Surname'])) accounts = sqlite3.connect("accounts.db") c = accounts.cursor() c.executemany('''INSERT INTO Students (FirstName, Surname) VALUES (?, ?)''', toDB)What goes into the functions valid_name and valid_surname is going to depend on how you define what a valid name is.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures