python中如何读取csv
普通方法读取(open函数打开csv文件,然后使用for循环读取内容):
with open("fileName.csv") as file:for line in file:
print line
网,大量的免费python教程,欢迎在线学习!
用CSV标准库读取:
import csvcsv_reader = csv.reader(open("fileName.csv"))
for row in csv_reader:
print row
用pandas读取:
import pandas as pddata = pd.read_csv("fileName.csv")
print data
data = pd.read_table("fileName.csv",sep=",")
print data
以上是 python中如何读取csv 的全部内容, 来源链接: utcz.com/z/525632.html