[Baypiggies] Want to redirect output to a csv file
jason at mischievous.org
Mon Apr 21 06:09:08 CEST 2008
Funny thing... I was reading and writing csv files just now.
I preprocess input files to make sure all the lines have same number
of fields as the header
checkcsv.py < input.csv > good.csv 2>bad.csv
The good lines go to stdout, the bad lines go to stderror.
reader = csv.reader(sys.stdin)
error = csv.writer(sys.stderr)
output = csv.writer(sys.stdout)
header = reader.next()
fields = len(header)
for line in reader:
if len(line) == fields:
On Apr 20, 2008, at 5:24 PM, Tabatchnick, Justin wrote:
> I am running an imported file and want to redirect the output to a
> csv file , what is the best way to accomplish this ?
> Justin Tabatchnick
> Intel, Folsom
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Baypiggies