c1=[]
for row in c:
c1.append(row[0:13])
c is a variable containing a csv file
i am going through every row in it and i want only the first 14 elements to be in the c1
what am i doing wrong?
c1=[]
for row in c:
c1.append(row[0:13])
c is a variable containing a csv file
i am going through every row in it and i want only the first 14 elements to be in the c1
what am i doing wrong?
Nicer:
c1= [row[:13] for row in c.readlines()]
if that doesn't work, you may not assigning to c properly.
Also keep in mind that if you want first 14 characters, you actually want to do row[:14] Then you get characters 0->13 inclusively, or 14 total.