Have a csv-file with time as heading for each column and first column with depth and temperature inbetween. n*m table, or plot. I'm having problems reading the csv file:

fname = r'C:\Users\Desktop\Temperature.csv'

T1 = '15.08.2012 16:09:10'
T2 = '15.08.2012 19:22:57'

initial = time.mktime(time.strptime(T1, "%d.%m.%Y %H:%M:%S"))
final = time.mktime(time.strptime(T2, "%d.%m.%Y %H:%M:%S"))

r = csv.reader(open(fname))
timelist = r.next()

#datafile =  open(fname, 'r').readlines()
time_out = open('C:\Users\Desktop\outfile.csv', 'w')

time_list = []

for i in range(1,len(timelist)):
    timedate = timelist.split(';')
    time_date = time.mktime(time.strptime(timedate[i], "%d.%m.%Y %H:%M:%S"))
    if initial <= time_date <= final:
print time_date

But the length of the timelist is 1. I am a beginner in csv file reading:(
What I want to do is decide which time intervall to be choosen, then i want it to be saved in lists.

The data looks like this:

Depth (m);15.08.2012 15:39:09;15.08.2012 16:09:10;15.08.2012 16:39:10;15.08.2012 16:43:36;15.08.2012 16:55:23;52.865;51.202;51.59;51.888;51.124;51.488;50.731;51.795;51.003;50.654;51.815;51.305;51.231;50.694;52.58 etc

So when you open it in excel:

Depth(m) 15.08.2012 15:39:09 15.08.2012 16:09:10 15.08.2012 16:39:10 etc
0        45.2323    32.332 23.233 ..........
1         .
2         .
3         .
4         etc

Help please!:P

I don't use the csv module much (at all); I find it just as easy to manipulate csv files manually. That said, if len(timelist) is 1, that sounds a lot like the csv.reader doesn't know your delimiter is ";". Also, according to the documentation, the open() statement needs to specify "rb" (why, I don't know). So your csv.reader statement should be: r = csv.reader(open(fname),'rb'), delimiter=";").
But, again, I think it's easier just to parse the file yourself. What would happen if you did it this way:

for str1 in r:
    for i in len(timedate): 
        time_date = time.mktime(time.strptime(timedate[i], "%d.%m.%Y
This article has been dead for over six months. Start a new discussion instead.