On Tue, Nov 03, 2009 at 07:45:42PM +0530, steve wrote:
f = open('Customer_IDs', 'r')small bug in the line above. The line above only strip()s the last
customer_ids = f.read().strip().split('\n') # Assuming each ID is present in
a separate line.
newline. So, all lines except the last still retain their '\n'.
Then, in your previous program, print only if the customer ID belongsand due to the bug above, the condition block is only entered when
to one the above list, i.e.
if customer_id in customer_ids:
print ...
customer_id is the same as the one in the last line of the file (since
all the other strings in customer_ids have a '\n')