The TextFile.txt file contains:
1 one
2 two
3 three
4 four
5 five
The python program:
file = open ("x.txt", "r")
for item in file:
x = item.split ('\s')
import numpy as np
a = np.array (x)
print (a)
Results:
['5 five']
But, wanna get all the elements of TextFile.txt as an array. How to achieve the same?