Word frequencies -- Python or Perl for performance?
jeff at ccvcorp.com
Fri Mar 22 21:32:28 CET 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.
More information about the Python-list