Advertisement
elena1234

Read file in Python

Feb 10th, 2022
933
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.15 KB | None | 0 0
  1. with open("test.txt", mode = "r") as my_file:
  2.     int_list = list(map(int, ([element for element in my_file.readlines()])))
  3.     print(sum(int_list))
  4.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement