i want to add ints that is stored in a file and add the numbers to find the total.. i took this code from a txt book but im getting the following error :
invalid literal for int() with base 10: '1 2 3 12 4 55'
how can i solve this if i want to read the numbers one by 1 not by using a list
f = open("intgers.txt", 'r')
theSum = 0
for line in f:
line = line.strip()
number = int(line)
theSum += number
print("The sum is", theSum)