Having the file TEST.txt structured as following:
a 45
b 45 55
c 66
When I try to open it:
import numpy as np
a= np.loadtxt(r'TEST.txt',delimiter='\t',dtype=str)
I have got the following error:
ValueError: Wrong number of columns at line 2
It's clearly due to the fact that the second line has three columns instead of two, but I can't find an answer to my problem using the documentation.
Is there anyway I can fix it keeping all the data into an array?
In Matlab I can do something like:
a=textscan(fopen('TEST.txt'),'%s%s%s');
Something similar in Python would be apreciated.