1,076,397 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Posts by StefanieZY

Hi everyone,

I need to use python to read some data in my csv file, but the file I have contains 15 rows of introduction in front. all the data I need is from the row 16. I am able to read the data as the way I want it if I remove the first 15 rows, but it's very troublesome to do it every time and I have a lot of csv files like that.

so I want to know if there is a way to let python skip the first 15 rows just read from row 16?

below is my code

import csv
import time
import datetime

tempReadings = csv.reader(open('newdata3.csv','rb'),delimiter=',')

for reading in tempReadings:

print "got: %s" % reading
(timestamp, format, temp) = reading

print "timestamp: %s" % timestamp

print "temp: %s" % temp

Thanks

StefanieZY
Newbie Poster
1 post since Nov 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
 
© 2013 DaniWeb® LLC
Page rendered in 0.0306 seconds using 2.45MB