Jul wrote: > hello, > > I have a .txt file that is in this format -- > > 12625 > 17000 > 12000 > 14500 > 17000 > 12000 > 17000 > 14500 > 14500 > 12000 > ...and so on... > > i need to create a python script that will open this file and have a > running sum until the end of file.
Untested: with open("numbers.txt", "r") as f: print sum(int(x) for x in f) -- Stephen Fairchild -- http://mail.python.org/mailman/listinfo/python-list