This seems like it should be the most basic thing to do in python that it should be almost a default option. I have a text file that has lines such as
123, [12, 23, 45, 67]
The second array is variable in length. How do I read this in? For whatever reason I cannot find a single piece of documentation on how to deal with '[' or ']' which one might argue is the single most basic character in python.
np.loadtxt was a bust, apparently this is only for the most simple of file formats
np.genfromtxt was a bust, due to the missing columns. BTW one would like to believe the missing_value functionality could be helpful here. Would be useful to know what, if anything, the missing_value thing actually does (it is not explained clearly in the documentation at all).
I tried the np.fromstring route which gives me
['123', '[12', '23', '45', '67]']
Presumably I could parse this item by item to deal with the '[' and ']' but at this stage I have just made my own python file reader to read in a fairly basic python construct!
As for the desired output, at this stage I would settle for almost anything. The obvious construct would be line by line of the form
[123, [12, 23, 45, 67]]