import pandas as pd
df = pd.read_csv(f'D:/test/fupan.csv')
print(df)
需求:
遍历文件:
第一次 a=20210101 b=20210102 c=20210103 d=['hello','hi','hello1']
第二次 a=20210102 b=20210103 c=20210104 d=['hello','hi','hello2']
结束了
你题目的解答代码如下:
import pandas as pd
df = pd.read_csv(f'fupan.csv')
print(df)
for idx, row in df.iterrows():
a = row[0]
b = row[1]
c = row[2]
d = row[3]
print(f'a={a} b={b} c={c} d={d}')
如有帮助,请点击我的回答下方的【采纳该答案】按钮帮忙采纳下,谢谢!