获取每一行
import csv
file = 'C:/Users/zyx/Desktop/blog.csv'
with open(file,'r',encoding='ISO-8859-1')as f:
reader = csv.reader(f)
for row in reader:
row = str(row)
print(row)
获取某一行
with open('data.csv', 'r') as f:
3 reader = csv.reader(f)
4 result = list(reader)
5 print(result[1])
获取某一列
with open('data.csv', 'r') as f:
3 reader = csv.reader(f)
4 for i in reader:
5 print(i[0])
网友评论