Given a text file named pop.txt. The content is below:
0 1650
10 1750
20 1860
30 2070
40 2300
50 2560
60 3040
70 3710
80 4450
90 5280
100 6080
110 6870
I would like to read it in the get_data function. The output should be like [0,1650],[10,1750]...[110,6870].
def get_data(path,name):
with open(path + file, 'r') as canary:
x = canary.read().splitlines()
return x
But the output is not what I want. Could you please help me fix my code?