I have a text file in which there are numbers in each line(only numbers). My color.txt
looks like:
3
3
5
1
5
1
5
When I read this to list using
f=open('D:\\Emmanu\\project-data\\color.txt',"r")
for line in f:
g_colour_list.append(line.strip('\n'))
print g_colour_list
the output is like
['3', '3', '5', '1', '5', '1', '5']
But I want it as:
[3,3,5,1,5,1,5]
How can I do that in the single line that is
g_colour_list.append(line.strip('\n'))
?