I am preparing a small function the gets feed with csv data in a list and db data in other list.
Those lists look like (for a single record):
['Name', 'Surname', 'Other']
I would like to allow the user to compare two values and decide which value to keep.
My while loop goes on forever even if I have break in it...
What am I doing wrong?
def check_fields(fields_csv, fields_db):
for field_csv in fields_csv:
for field_db in fields_db:
if field_csv == field_db:
print "1) Dato nel file csv: " + field_csv
print "2) Dato nel database: " + field_db
answer = str(raw_input("Which field you want to keep? [1 or 2]: "))
if answer == "1":
print "You choose 1"
field_import = field_csv
elif answer == 2:
print "You choose"
field_import = field_db