Python中写入csv和txt

这里博主只贴出自己写的代码

import csv
a=[[x for x in range(64)]]*10
b=[13,14]
with open('csvfilea.csv','w') as csvresult:
	spamwriter=csv.writer(csvresult,dialect='excel')
	for a1 in a:
		spamwriter.writerow((a1))
with open('csvfileb.txt', 'w') as csvresult:
	for i in b:
		csvresult.write(str(i)+'\r\n')

详情可以参考:

http://www.41443.com/HTML/Python/20130311/137281.html

猜你喜欢

转载自blog.csdn.net/hguo11/article/details/53633895