Why does this:
for i in reader:
for j in empsTbl:
if i[0] == j.inmptl_wiw_userid:
print "Match"
print over 500 results
And this:
for i in empsTbl:
for j in reader:
if j[0] == i.inmptl_wiw_userid:
print "Match"
print no results?
Looks like your
readeris a generator, that can be read only once. Maybe a file reader?In the first case you read it only once and compare each value to all elements of
empsTbl, which is apparently a list (or tuple or set or dict, i.e. can be read as much as you want).In the second case, you read it completely while being at the first item of
empsTbl(apparently does not match it if nothing is printed) and then with the second item ofempsTblit cannot be read again (i.e. the file is read over).UPDATE: With this number of records you can copy everything into Python lists which can be iterated over and over (set/dictionary would be probably even better, as they offer you much faster lookup times)
Maybe something like this: