[Tutor] Eek, help!

Kent Johnson kent_johnson at skillsoft.com
Thu Nov 4 18:10:27 CET 2004


Um...what does pause.anyKey() do? Is it possibly waiting for you to press a 
key?

Kent

At 02:25 AM 11/5/2004 +1300, Liam Clarke wrote:
>Hi all,
>
>I have belatedly come to use dictionaries, and I was having some
>trouble with how to read/write them from a file,  so I looked at Alan
>Gauld's section on it. I've pretty much copied his code straight
>through, and, well, I've broken it somehow. In fact, it's hanging
>Python, and it even hangs the debugger, which is a first, I must
>admit.
>
>The errant code as follows is -
>
>h={"Like":"two"}
>filename = './dat/hshmd5.tbl'
>
>store = file(filename,'w')
>
>for name, entry in h.items():
>     store.write(name + '\n')
>     store.write(entry + '\n')
>
>store.close()
>
>print 'Wrote hash'
>pause.anyKey()
>print
>
>book={}
>
>store2 = file(filename,'r')
>
>while store2:
>     name = store2.readline().strip()
>     entry = store2.readline().strip()
>     book[name] = entry
>
>store2.close()
>
>It writes OK, it gets up to anyKey bit and... stops. Anything jump out
>at anyone? I am confused.
>
>Thanking you in advance,
>
>Liam Clarke
>--
>'There is only one basic human right, and that is to do as you damn well 
>please.
>And with it comes the only basic human duty, to take the consequences.
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list