So this is my code:
import csv
particle_counter = file('C:/Users/Desktop/Level 2 files/HiSAM1_data_160206_134230.csv','rU')
gas_csv = file('C:/Users/Desktop/Level 2 files/gas_0.csv','rU')
gps_csv = file('C:/Users/Desktop/Level 2 files/gps_0.csv','rU')
pm2_5_csv = file('C:/Users/Desktop/Level 2 files/pm25_0.csv','rU')
reader1 = csv.reader(particle_counter)
reader2 = csv.reader(gas_csv)
reader3 = csv.reader(gps_csv)
reader4 = csv.reader(pm2_5_csv)
def skipline(n,filename):
x =0
while x < n in filename:
reader = csv.reader(filename)
result = next(reader)
return result
print(skipline(0,particle_counter) )
I've been trying to know how do you skip headers to files that have different number of headers in one single function. However, I think i got what i need in order to do that but when i run the program i get:
In[21]: %run "C:/Users/Desktop/Level 2 files/skiplinefunction.py"
None
What i expected to happen was that the function would take each file and skip the number of header lines that each individual file has until it reaches values. I tried printing one file to see if it skiped the lines on that file but i got the None. What does that mean? is there anything wrong in my program that I can't seem to see? How can i fix this?