خرید بک لینک

Vote count: 0

I have a list of string numbers and a counter inside a for loop. If the counter is in the list I do something, like this:

codes = ['123','1245','564','8920','57498']
f = open('path_to_file','r')
for lineno, line in enumerate(file, start=1):
    if str(lineno) in codes:
        print str(lineno) + ' is in the list'

The problem is that it seems that the if condition is always true from a certain point, because once lineno = 123 it always print the sentence inside the if block.

Anyone see something wrong with this code? Thanks

asked 41 secs ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 8 مرداد 1395 ساعت: 4:58

صفحه بندی