I am trying to read a long string of values separated by a backslash into an
array of known size.

Here is my attempt,

from numpy import *
ay, ax = 384, 512
a = zeros([ay, ax])
for line in open('out.out'):
    data = line.split('\\')
k = 0
for i in range(ay):
    for j in range(ax):
        a[i, j] = data[k]
        k+=1
but, I receive the following error.

Traceback (most recent call last):
  File "C:/Users/bryan/Desktop/dose_array.py", line 13, in <module>
    a[i, j] = data[k]
ValueError: setting an array element with a sequence.




-- 
"The game of science can accurately be described as a never-ending insult to
human intelligence." - João Magueijo
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to