Using Python To Calculate Sum In Csv Row
I want to calculate sum of each row with Python in Excel file saved as .csv like this example:
Solution 1:
You could try something like this:
import csv
with open('foo.csv') as csvfile:
spamreader = csv.reader(csvfile)
for row in spamreader:
sum = 0
for i in row:
sum += int(i)
print(sum)
Post a Comment for "Using Python To Calculate Sum In Csv Row"