Problem loading a file of words

Peter Otten __peter__ at web.de
Mon Jul 25 15:55:10 CEST 2005


teoryn wrote:

> I'm still lost as to why my old code would only work for the small
> file, and another interesting note is that with the larger file, it
> would only write "zzz for zzz" (or whatever each word was) instead of
> "Created key zzz for zzz". However, it works now, so I'm happy.

Happy as long as you don't know what happened? How can that be?
Another guess then -- there may be inconsistent newlines, some "\n" and some
"\r\n":

>>> garbled = "garbled\r\n"[:-1]
>>> print "created key %s for %s" % ("".join(sorted(garbled)), garbled)
abdeglr for garbled

Peter 




More information about the Python-list mailing list