Creating A New Column In A Csv File From A List
I have been trying to figure out how to take a list and use it to create a new column in my csv file. The idea is that I have a cvs file, I've taken the last item of each row to cr
Solution 1:
If you want to access the ith element of delay
, then your code is correct. However, since you say for i in delay
, i
is already an element of delay
. Try changing out delay[i]
for just i
in the last line. An example is below
list = [5, 4]
for i in list:
print i
That will return:
5
4
However, if you do this:
list = [5, 4]
for i in list:
print list[i]
This won't work because list
only has elements with indices 0 and 1, not 4 and 5.
Post a Comment for "Creating A New Column In A Csv File From A List"