readline() - problem
piotr at kolodziejczyk.waw.pl
piotr at kolodziejczyk.waw.pl
Tue Oct 2 08:13:21 EDT 2007
On 2 Pa , 13:39, Ben Finney <bignose+hates-s... at benfinney.id.au>
wrote:
> pi... at kolodziejczyk.waw.pl writes:
> > import string
>
> Why import 'string' if you're not using it?
>
> > f=open('/test/test.asc','r')
> > o=open('/test/out.asc','w')
> > for line in f:
> > s= f.readline()
>
> Your line object is already bound to the 'line' name in each
> iteration. You need to use that, not attempt to read yet another line
> each time.
>
Of course, it helped. Many thanks for all.
piotr
More information about the Python-list
mailing list