I have a .txt file made like this:
(12,13,14,15)
(1,2,4,5)
(1,2,3,4,5)
and so on. I would like to store the file into a numpy array of shape (N,4), discarding those tuples which have more than 4 elements.
I've tried with
np.genfromtxt('filename.txt', delimiter=',', invalid_raise=False)
but I get NaN for the first and the last term of each line due to the presence of '(' and ')'. How can I solve it?