I'm guessing you are also using numpy and that you want arrays (or matrices) for the sake of either (a) matrix and array functions or (b) much greater processing speed.

Add
from numpy import *

Then hat you can do is go back and forth: Build what you intend to be an array, but build it as a list using append.

then ar=array(list)

converts it.

If you want to change its size again, convert it back to a list, change it, convert it back to an array.

The functions you need are list(), array(), and possibly matrix()


 from numpy import *
 a=[1,2,3]
 type(a)
<type 'list'>
 ar=array(a)
 ar
array([1, 2, 3])
 matrix(ar)
matrix([[1, 2, 3]])
 type(ar)
<type 'numpy.ndarray'>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to