import csv
#打开文件,用with打开可以不用去特意关闭file了,python3不支持file()打开文件,只能用open()
with open("XXX.csv","r",encoding="utf-8") as csvfile:
#读取csv文件,返回的是迭代类型
read = csv.reader(csvfile)
for i in read:
print(i)
import csv
#打开文件,用with打开可以不用去特意关闭file了,python3不支持file()打开文件,只能用open()
with open("XXX.csv","r",encoding="utf-8") as csvfile:
#读取csv文件,返回的是迭代类型
read = csv.reader(csvfile)
for i in read:
print(i)
本文标题:python3 读取CSV文件
本文链接:https://www.haomeiwen.com/subject/dpvczttx.html
网友评论