python 3.x - Python3.4 : List to CSV -


i'm trying convert list csv.

import csv import pandas pd  ciklist = []  open('/home/a73nk-xce/pycharmprojects/sp500_list/stockchar/cik.csv', 'r', newline='') csvfile: spamreader = csv.reader(csvfile) row in spamreader:     eachrow in row:         eachrow = eachrow.lstrip('0')         ciklist.append(eachrow)  myfile = open('newcik.csv', 'wb') wr = csv.writer(myfile, quoting=csv.quote_all) wr.writerow(ciklist) 

when running code return following:

typeerror: 'str' not support buffer interface 

change:

myfile = open('newcik.csv', 'wb') 

to:

myfile = open('newcik.csv', 'w') 

Comments

Popular posts from this blog

xslt - Substring before throwing error -

Google Cloud Bigtable Durability/Availability Guarantees -

php variable $_SERVER['SERVER_ADDR'] is blank when using crontab -