Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. # Example 4: Write a function that sums up integers from a text file, one int per line.
  2. file = open("TextFile1.txt")
  3. s = 0
  4. for line in file.readlines():
  5. print line
  6. i = int(line)
  7. s += i
  8. print s
  9. file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement