Fantastic! I have this, which now works. Is there a better place to put string.strip?
aisle_one = ["chips", "bread", "pretzels", "magazines"] grocery_list = open("grocery_list.txt", "r") for line in grocery_list.readlines(): if line.strip() in aisle_one: print "success! i found %s" % line else: print "no joy matching %s" % line grocery_list.close() Thanks Emile. On Wed, Jul 14, 2010 at 11:02 AM, Emile van Sebille <em...@fenx.com> wrote: > Try adding some debugging code here, maybe changing the print to: > print "no joy matching %s" % line > > Then read up on readlines and string.strip. > > HTH, > > Emile > > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor