[Tutor] reading 2nd line
Jens Kubieziel
maillist@kuwest.de
Sun Jan 26 15:02:00 2003
Hi,
I have here several text files, where I want to read second line of each
file and no idea how to do it. Those files are csv-files exported from MS
Excel and have following format:
date,open,high,low,close,sales
01-01-03,11.23,11.24,10.66,10.87,678537
On a shell I would write:
head -n 2 $FILE | tail -n 1
Can you give me a hint on this?
If I read those line, I want to read out the close price (10.87). My
current solution looks like:
>>> line = "01-01-03,11.23,11.24,10.66,10.87,678537"
>>> single = line.split(",")
>>> print single[4]
Is there a better solution?
--
Jens Kubieziel mailto:jens@kubieziel.de
Adultery:
Putting yourself in someone else's position.