I'm confused by the behaviour of the following python-script I wrote: #!/usr/bin/env python #I first made a data file 'test.dat' with the following content #1.0 2 3 #4 5 6.0 #7 8 9 import numpy as np lines=[line.strip() for line in open('test.dat')] #convert lines-list to numpy-array array_lines=np.array(lines) #fetch element at 2nd row, 2nd column: print array_lines[1, 1]
When running the script I always get the following error: IndexError: invalid index Can anyone here explain me what I am doing wrong and how to fix it? thanks in advance jean -- https://mail.python.org/mailman/listinfo/python-list