Say, I have a file which has the following content:
1
2
3
4
5
6
7
8
9
10
I want create it into a list of integers in Python3, i.e [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
f = open("stan.txt","r")
myList = []
for line in f:
myList.append(line)
print(myList)
lst = []
for i in myList:
i = i[:-1]
lst.append(int(i))
print(lst)
It is my verbose code. Is there an elegant and concise way to do it?