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

2007-04-14 Thread 7stud
On Apr 11, 1:13 pm, [EMAIL PROTECTED] wrote: > Hi folks, > > The first line in the file I am examining will be a number followed by > more whitespace. Looks like I cannot split by whitespace? > but I get 'cannot open > file' when i try to read from an archive.. ...and that led you to conclude tha

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

2007-04-14 Thread Gabriel Genellina
En Fri, 13 Apr 2007 08:59:30 -0300, <[EMAIL PROTECTED]> escribió: > 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. Try a small, failing example and post the code and th

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

2007-04-13 Thread mike . aldrich
On Apr 11, 4:20 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 11 Apr 2007 17:15:48 -0300, <[EMAIL PROTECTED]> escribió: > > > The file contents have leading whitespace, then a number: > > 123456 \n > > I expect to return '123456' > > And nothing following the number? > > p

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

2007-04-11 Thread Gabriel Genellina
En Wed, 11 Apr 2007 17:15:48 -0300, <[EMAIL PROTECTED]> 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 Genell

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

2007-04-11 Thread mike . aldrich
On Apr 11, 4:10 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 11 Apr 2007 16:13:42 -0300, <[EMAIL PROTECTED]> escribió: > > > > > > > Hi folks, > > I am trying to read the first occurence of non-whitespace in a file, > > within a zipfile. Here is my code: > > > zipnames = glob.glob("

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

2007-04-11 Thread Gabriel Genellina
En Wed, 11 Apr 2007 16:13:42 -0300, <[EMAIL PROTECTED]> escribió: > Hi folks, > I am trying to read the first occurence of non-whitespace in a file, > within a zipfile. Here is my code: > > zipnames = glob.glob("*") > for zipname in zipnames: > z = zipfile.ZipFile(zipname, "r") > for filename

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

2007-04-11 Thread Larry Bates
[EMAIL PROTECTED] wrote: > Hi folks, > I am trying to read the first occurence of non-whitespace in a file, > within a zipfile. Here is my code: > > zipnames = glob.glob("*") > for zipname in zipnames: > z = zipfile.ZipFile(zipname, "r") > for filename in z.namelist(): > count = len(z.read