Re: [Tutor] How to populate a dictionary

2008-07-17 Thread Alan Gauld
"bob gailer" <[EMAIL PROTECTED]> wrote As I understood it the list policy is: 1) not solve homework problems. 2) request students to tell us exactly what problems they were running into e.g. expected output, actual output, exceptions, ... 3) then give specific suggestions We seem to hav

Re: [Tutor] How to populate a dictionary

2008-07-17 Thread Alan Gauld
"Michiel Overtoom" <[EMAIL PROTECTED]> wrote Let me suggest some improvements. You can process all the lines in a textfile like this: for line in open("dates.txt").readlines(): print line Or just for line in open("dates.txt"): print line.rstrip() So, your little homework prog

Re: [Tutor] How to populate a dictionary

2008-07-17 Thread Alan Gauld
<[EMAIL PROTECTED]> wrote The assignment is to create a dictionary from a text file: ok, since it's 'homework' I won't give the whole answer but will try to point you in the right direction. Your program should start by creating an empty dictionary called dates. Then your program will get

Re: [Tutor] How to populate a dictionary

2008-07-17 Thread bob gailer
Several reactions: --- As I understood it the list policy is: 1) not solve homework problems. 2) request students to tell us exactly what problems they were running into e.g. expected output, actual output, exceptions, ... 3) then give

Re: [Tutor] How to populate a dictionary

2008-07-17 Thread FT
Dates = {} def read_Dates (Dates): if os.path.exists(FILE_NAME): store = open(FILE_NAME,'r') for line in store: name = line.rstrip() entry = store.next().rstrip() Dates[name] = entry store.close() def save_Dates (Dates): store =

Re: [Tutor] How to populate a dictionary

2008-07-17 Thread Michiel Overtoom
josetjr wrote... >Hello, I am taking python this summer, and have run into a problem. Let me suggest some improvements. You can process all the lines in a textfile like this: for line in open("dates.txt").readlines(): print line Furthermore, if you have a string in the form of