📜  如何使用python代码示例中的列表对csv python中的列求和

📅  最后修改于: 2022-03-11 14:46:27.445000             🧑  作者: Mango

代码示例1
import csv
csv_file = csv.reader(open("your_file_name.csv"))

dist = 0
for row in csv_file:
    _dist = row[2]
    try: 
        _dist = float(_dist)
    except ValueError:
        _dist = 0

    dist += _dist