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
ED] To: tutor@python.org Sent: Thursday, July 17, 2008 8:07 AM Subject: [Tutor] How to populate a dictionary Hello, I am taking python this summer, and have run into a problem. The assignment is to create a dictionary from a text file: "12/07/0526 = St Felix IV begins his reign as Catholic Po

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

[Tutor] How to populate a dictionary

2008-07-17 Thread josetjr
Hello, I am taking python this summer, and have run into a problem. The assignment is to create a dictionary from a text file: "12/07/0526 = St Felix IV begins his reign as Catholic Pope" "12/07/1109 = Crusaders capture Syria's harbor city of Tripoli" "12/07/1191 = Richard Coeur de Lion and Crusa