Word frequencies -- Python or Perl for performance?
Jeff Shannon
jeff at ccvcorp.com
Fri Mar 22 15:32:28 EST 2002
Anders M Eriksson wrote:
> Hello Jim!
>
> I tried to run the program in Python 2.1 but I get errors
>
> > for line in file:
> Here I get the error ^
> for line in file:
> TypeError: loop over non-sequence
>
> Is this something specific for Python 2.2, or just a typo?
For Python 2.1, change the offending line to:
for line in file.xreadlines():
and you should get the behavior that you want.
Jeff Shannon
Technician/Programmer
Credit International
More information about the Python-list
mailing list