On Apr 23, 1:22 pm, Bruno Desthuilliers <bruno.
[EMAIL PROTECTED]> wrote:
> kdwyer a écrit :> On Apr 23, 12:16 pm, Simon Strobl <[EMAIL PROTECTED]> wrote:
> (snip)
> >> #!/usr/bin/python
>
> >> import sys
>
> >> frqlist = open('my_frqlist.txt', 'r')
> (snip)
> >> frq = {}
>
> >> for line in frqlist:
> >>     line = line.rstrip()
> >>     frequency, word = line.split('|')
> >>     frq[word] = int(frequency)
>
> (snip)
>
> > It works for me, save that you need to read the file into a list first
>
> You don't, unless you're using an old python versions (I'd say 2.3 or
> older). Files are now their own iterators.

*Fiddles with the interpreter for a moment*
So they are - I'd quite forgotten about that - thanks for the
reminder!

K
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to