Re: [Tutor] Searching a text file's contents and comparing them toalist

2010-07-14 Thread bob gailer
[snip] Since you look up the items in the grocery list it seems to me a dictionary relating each item to its aisle would be best. inventory = {"chips" : 1, "bread" : 1, "pretzels" : 1, "magazines" : 1, "juice" : 2, "ice cream" : 2, "asparagus" : 3} MAX_AISLE = 3 aisle

Re: [Tutor] Searching a text file's contents and comparing them toalist

2010-07-14 Thread Nick Raptis
On 07/14/2010 11:57 PM, Eric Hamiter wrote: Last question (for today, at least): Right now, the output is less than aesthetically pleasing: (['Located on aisle 1: ', 'bread', 'magazines'], ['Located on aisle 2: ', 'juice', 'ice cream'], ['Located on aisle 3: ', 'asparagus'], ['Not found in the d

Re: [Tutor] Searching a text file's contents and comparing them toalist

2010-07-14 Thread christopher . henk
Eric Hamiter wrote on 07/14/2010 04:57:57 PM: > Thanks for the pointers! This is now working, albeit probably ugly and clunky: > > > aisle_one = ["chips", "bread", "pretzels", "magazines"] > aisle_two = ["juice", "ice cream"] > aisle_three = ["asparagus"] > > def find_groceries(): > with o

Re: [Tutor] Searching a text file's contents and comparing them toalist

2010-07-14 Thread Eric Hamiter
Thanks for the pointers! This is now working, albeit probably ugly and clunky: aisle_one = ["chips", "bread", "pretzels", "magazines"] aisle_two = ["juice", "ice cream"] aisle_three = ["asparagus"] def find_groceries(): with open("grocery_list.txt") as grocery_list: first_trip = ["L

Re: [Tutor] Searching a text file's contents and comparing them toalist

2010-07-14 Thread Alan Gauld
"Eric Hamiter" wrote aisle_one = ["chips", "bread", "pretzels", "magazines"] aisle_two = ["juice", "ice cream"] aisle_three = ["asparagus"] def find_groceries(): grocery_list = open("grocery_list.txt", "r") for line in grocery_list.readlines(): See previous about removing the redundan