Compare list entry from csv files
tolidtm at gmail.com
Mon Nov 26 22:08:08 CET 2012
I'm trying to complete a namebook CSV file with missing phone numbers
which are in another CSV file.
the namebook file is structured:
First name;Lastname; Address; City; Country; Phone number, where the
phone number is missing.
The phonebook file is structured as:
Name; phone, where the name shows first and last name and sometimes
they are written together like "BillGates" or "Billgatesmicrosoft".
I'm importing the files as lists ex.: phonelist" ["First name", "Last
in the loop I can compare the entry for ex. "Bill Gates" in the field
"BillGatesmicrosoft" but I can't index it so I can only take the phone
number from the file with the phones and insert it to field in the
Namebook. Can you please give me an advice?
origf = open('c:/Working/Test_phonebook.csv', 'rt')
phonelist = 
reader = csv.reader(origf, delimiter=';')
for row in reader:
secfile = open('c:/Working/phones.csv', 'rt')
phones = 
readersec = csv.reader(secfile, delimiter=';')
for row in readersec:
More information about the Python-list