Reading the first line of a file (in a zipfile)

mike.aldrich at gmail.com mike.aldrich at gmail.com
Fri Apr 13 13:59:30 CEST 2007


On Apr 11, 4:20 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
wrote:
> En Wed, 11 Apr 2007 17:15:48 -0300, <mike.aldr... at gmail.com> escribió:
>
> > The file contents have leading whitespace, then a number:
> >      123456       \n
> > I expect to return '123456'
>
> And nothing following the number?
>
> py> line = "     123456       \n"
> py> print line.strip()
> 123456
>
> --
> Gabriel Genellina

That works fine if I am using the interpreter, but I get 'cannot open
file' when i try to read from an archive..
Does that make sense? Sorry, this is my 2nd python script.




More information about the Python-list mailing list