csv into multiple columns using split function using python

handar94 at gmail.com handar94 at gmail.com
Tue Nov 29 14:35:26 EST 2016


I am trying to split a specific column of csv into multiple column and then appending the split values at the end of each row.

`enter code here`
------------------------------------------------
import csv
fOpen1=open('Meta_D1.txt')

reader=csv.reader(fOpen1)
mylist=[elem[1].split(',') for elem in reader]
mylist1=[]

for elem in mylist1:
    mylist1.append(elem)


#writing to a csv file
with open('out1.csv', 'wb') as fp:
    myf = csv.writer(fp, delimiter=',')
    myf.writerows(mylist1)

---------------------------------------------------
Here is the link to file I am working on 2 column. https://spaces.hightail.com/space/4hFTj

Can someone guide me further?




More information about the Python-list mailing list