On Tue, Nov 03, 2009 at 07:45:42PM +0530, steve wrote: >> f = open('Customer_IDs', 'r') >> customer_ids = f.read().strip().split('\n') # Assuming each ID is present in >> a separate line. >> > small bug in the line above. The line above only strip()s the last > newline. So, all lines except the last still retain their '\n'.
Blame incomplete testing. >> Then, in your previous program, print only if the customer ID belongs >> to one the above list, i.e. >> >> if customer_id in customer_ids: >> print ... > and due to the bug above, the condition block is only entered when > 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') Yes, thanks for pointing this out. Even I felt I rushed sending in the mail, after I read the better suggestions. Thanks for pointing this out. Kumar -- Kumar Appaiah _______________________________________________ To unsubscribe, email ilugc-requ...@ae.iitm.ac.in with "unsubscribe <password> <address>" in the subject or body of the message. http://www.ae.iitm.ac.in/mailman/listinfo/ilugc