Iterating over a dictionary's sorted keys
Ivan Van Laningham
ivanlan at home.com
Fri May 26 00:03:19 EDT 2000
Hi All--
Alan Daniels wrote:
>
> On 25 May 2000 08:56:38 GMT, Remco Gerlich
> <scarblac-spamtrap at pino.selwerd.nl> wrote:
>
> [snip...]
> >Why the problem with multiple lines and an extra variable here and there?
>
> Yes, but the short version reminds me very much of one of my favorite
> python idioms:
>
> lines = open("some_file", "rt").readlines()
>
If you don't want the newlines, you can do this:
alist=open("some_file","rt").read().split()
in 1.6.
<at-least-you-should-be-able-to>-ly y'rs,
Ivan
----------------------------------------------
Ivan Van Laningham
Axent Technologies, Inc.
http://www.pauahtun.org/
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps: Cu Chi, Class of '70
Author: Teach Yourself Python in 24 Hours
More information about the Python-list
mailing list