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, t...@that.com
CompanyA, 1231234455, t...@this.com
CompanyC, 1011011111, n...@this.com
CompanyD, 2222222222, o...@olde.com

"""
site = """Company,Email,Phone
"Company3","noth...@nada.com","1234560000"
"CompanyD","o...@olde.com","2222222222"
"Company1","t...@that.com","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  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to