Re: [Tutor] Fwd: Trying to enter text from a file to a Dictionary

2006-01-27 Thread Ben Markwell
Hi Ben,Yes, that's the point: Python doesn't know when to stop.  *grin* The way we've rewritten the loop:while True:...is an "infinite" loop that doesn't stop unless something in the loop'sbody does something extraordinary, like "breaking" out of the loop. Python is much dumber than we

Re: [Tutor] Fwd: Trying to enter text from a file to a Dictionary

2006-01-27 Thread Danny Yoo
> Here's one way we can avoid the problem: > > while True: > word = f.readline() > defn = f.readline() > if not word or not defn: >break > ... > > Does this make sense? > > It does mostly...I don't see why you need the: > > if not word or not defn:

[Tutor] Fwd: Trying to enter text from a file to a Dictionary

2006-01-27 Thread Ben Markwell
Hello Danny Thanks for replying to my post. >   I tried :>>   for line in f:Thanks for your reply to my post. >   gloss[line] = f.readline()> This should have worked, but there's one problem.  Whenever we're doingsomething like:for line in f:...there can be some interference bet