When opening a CSV file, the column of integers is being converted to a string value (\'1\', \'23\', etc.). What\'s the best way to loop through to convert these back to intege
I think this does what you want:
import csv
with open('C:/Python27/testweight.csv', 'r', newline='') as f:
reader = csv.reader(f, delimiter='\t')
header = next(reader)
rows = [header] + [[row[0], int(row[1])] for row in reader if row]
for row in rows:
print(row)
Output:
['Account', 'Value']
['ABC', 6]
['DEF', 3]
['GHI', 4]
['JKL', 7]