I am attempting to extract values from a txt file using numpy.genfromtxt() method. MY txt file looks like this:
'! dt tot nsave readext\n',
' 0.002 200 500 F\n',
'!----------------------------------------------------------------------\n',
'! xdomain ydomain \n',
' 7.5 7.5\n',
'!----------------------------------------------------------------------\n',
'! maxnewts maxiters atol\n',
' 40 100 0.001\n',
'!----------------------------------------------------------------------\n',
'! p \n',
' 600 \n',
But using numpy.genfromtxt("file.txt", comments='!')
gives me:
Line #4 (got 2 columns instead of 4)
Line #7 (got 3 columns instead of 4)
Line #10 (got 1 columns instead of 4)
How can I make numpy.genfromtxt
flexible about the column sizes?