If the file is not too big, you can just read the file into an array, use a list comprehension to convert the lines into a list of integers and then compute the sum of that:
sum([int(s.strip()) for s in open('foo.txt').readlines()])
However, this reads the entire file into memory. If your file is large it would probably be less memory-intensive to accumulate the sum in an imperative manner:
result = 0
for s in open('foo.txt'): result += int(s.strip())
Or as a generator expression so that a list does not need to be stored in-memory
sum(int(s.strip()) for s in open('foo.txt'))