python csv

Python 读取csv的某行

Python 读取csv的某列

Python写了一个可以提取csv任一列的代码,欢迎使用。Github链接

 

 

两个list写入csv文件
column1,column2


#coding:utf-8
import csv
column1 = [1,2,3]
column2 = [4,5,6]


L= (column1,column2)
change = zip(column1,column2)

#按行写入
csvfile111 = file('csv_row.csv', 'wb')
writer = csv.writer(csvfile111)
writer.writerows(L)

# #按列写入
csvfile111 = file('csv_line.csv', 'wb')
writer = csv.writer(csvfile111)
writer.writerows(change)

 

posted on 2017-05-25 17:37  寒星12345678999  阅读(253)  评论(0编辑  收藏  举报