Hello, list.
I can't understand why the print statement is not printed with the
operator '==', but is printed when using 'in'.
Here's the code:
#===
import csv

bv = """NAME,BVADDRTELNO1,BVADDREMAIL
Company1, 1234567788, [email protected]
CompanyA, 1231234455, [email protected]
CompanyC, 1011011111, [email protected]
CompanyD, 2222222222, [email protected]

"""
site = """Company,Email,Phone
"Company3","[email protected]","1234560000"
"CompanyD","[email protected]","2222222222"
"Company1","[email protected]","1234567788"
"""

bv = bv.upper() # This is just to make the data more homogeneous and
detect duplicates more easily


site = site.upper()


bvreader = csv.DictReader(bv.splitlines())

sitelist = csv.DictReader(site.splitlines())

bvreaderone = list(bvreader)

# this does not work:
for row in sitelist:
   for line in bvreaderone:
       if row['EMAIL'] == line['BVADDREMAIL']:
           print line['NAME'], row['COMPANY']

# but this does work:
for row in sitelist:
   for line in bvreaderone:
       if row['EMAIL'] in line['BVADDREMAIL']:
           print line['NAME'], row['COMPANY']

#==

Regards,

Eduardo
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to