How about this:
import numpy as np
with open('test_file.txt') as file:
arr = np.array(
[
np.array([float(num) for num in line.strip().split("")])
for line in file
]
)
print(arr)
and the array should look like the one below:
[array([1., 2., 3., 4.]) array([1., 2., 3.])
array([1., 2., 3., 4., 5., 6.])]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…