I have a text file for exemple:
1 2 3
4 5 6 7
8 9
I want to get the output [1, 2, 3], [4, 5, 6, 7], [8, 9]
.
I tried the following code:
with open('name_file.txt', 'r') as f:
text=f.readlines()
But I got the following output:
'1\t2\t3\n',
'4\t5\t6\t7\n',
'8\t9\n',