有很多使用 python 读取 csv 数据的例子,比如下面这个:
import csv
with open('some.csv', newline='') as f:
reader = csv.reader(f)
for row in reader:
print(row)
我只想读取一行数据并将其输入到各种变量中。我该怎么做?我到处都找过了。
我的代码只检索 i 的值,其他值都不检索
reader = csv.reader(csvfile, delimiter=',', quotechar='"')
for row in reader:
i = int(row[0])
a1 = int(row[1])
b1 = int(row[2])
c1 = int(row[2])
x1 = int(row[2])
y1 = int(row[2])
z1 = int(row[2])