Re: [Tutor] read text file in zip archive, process, plot

2007-04-15 Thread Andreas Kostyrka
* Kent Johnson <[EMAIL PROTECTED]> [070415 20:30]: > Washakie wrote: > > Thanks so much! Now another task, associated with this one... what I > > actually ultimately want is to just pull out several fields from the > > text file in the zip archive (there is actually only one file).. so, my > > g

Re: [Tutor] read text file in zip archive, process, plot

2007-04-15 Thread Kent Johnson
Washakie wrote: > Thanks so much! Now another task, associated with this one... what I > actually ultimately want is to just pull out several fields from the > text file in the zip archive (there is actually only one file).. so, my > goal is the to create a file that looks like: > > t[0], x[0],

Re: [Tutor] read text file in zip archive, process, plot

2007-04-15 Thread Washakie
Thanks so much! Now another task, associated with this one... what I actually ultimately want is to just pull out several fields from the text file in the zip archive (there is actually only one file).. so, my goal is the to create a file that looks like: t[0], x[0], y[0] t[1], x[1], y[1] t[2], x

Re: [Tutor] read text file in zip archive, process, plot

2007-04-15 Thread Kent Johnson
John W wrote: > Kent and Alan: better? > .j > > import zipfile > import os > import pylab as P > iFile = raw_input("Which file to process?") > > def openarchive(filename): > """ open the cmet archive and read contents of file into memory """ > z = zipfile.ZipFile(filename, "r") > for

Re: [Tutor] read text file in zip archive, process, plot

2007-04-15 Thread Andreas Kostyrka
* Washakie Wyoming <[EMAIL PROTECTED]> [070415 14:25]: > Thank you both! That seems to make my code much more clear... I thought > it was foolish writing files, but I just couldn't determine how to > parse the data! > > Kent, one thing, regarding: > x = [] > t = [] > for l

[Tutor] read text file in zip archive, process, plot

2007-04-15 Thread John W
Kent and Alan: better? .j import zipfile import os import pylab as P iFile = raw_input("Which file to process?") def openarchive(filename): """ open the cmet archive and read contents of file into memory """ z = zipfile.ZipFile(filename, "r") for filename in z.namelist(): print f

Re: [Tutor] read text file in zip archive, process, plot

2007-04-15 Thread Washakie Wyoming
Thank you both! That seems to make my code much more clear... I thought it was foolish writing files, but I just couldn't determine how to parse the data! Kent, one thing, regarding: x = [] t = [] for l in data[stind:-1]: l = l.split() # Split on whitespace

Re: [Tutor] read text file in zip archive, process, plot

2007-04-15 Thread Kent Johnson
Washakie Wyoming wrote: > Greetings all! > > I'm including here a first python program! Very nice. It's written to > read in a text file which resides in a .zip archive, extract two fields > and plot them. It uses some bits from pylab for the plotting. > > I'm writing to ask for ways to improve i

Re: [Tutor] read text file in zip archive, process, plot

2007-04-15 Thread Alan Gauld
"Washakie Wyoming" <[EMAIL PROTECTED]> wrote > I'm writing to ask for ways to improve it. I feel like the > writing and reading from 'jnk' files is definitely a hack! Yup! I'm not sure why you do it, at least the first time. You read the file into memory, why not just process it there? You can s