按照书中代码编写,打印天气csv文件中的Max TemperatureF列温度数据,但有点不能理解这段代码中for循环是如何遍历表格的,有谁能具体解释一下吗?(比如:代码row[1]中[1]为什么被认定是列而不是行?还有for循环遍历csv文件时,是从左至右一格一格的遍历完一行然后再遍历下一行吗?)
import csv
file='C:/Users/lc/Desktop/python_work/天气数据.csv'
with open(file) as f:
read=csv.reader(f)
print(next(read))
highs=[]
for row in read:
high=row[1]
highs.append(high)
print(highs)