3d array?

Cliff Crawford cjc26 at nospam.cornell.edu
Thu Jan 18 20:42:19 EST 2001


* Dan Stromberg <strombrg at seki.acs.uci.edu> menulis:
| I love python, but is there really no good way of doing a 3d array of
| a scalar type?  How about of an aggregate type?

threedee = [ [ [ 1, 2, 3 ],
               [ 4, 5, 6 ],
               [ 7, 8, 9 ] ],
             [ [ 10, 11, 12 ],
               [ 13, 14, 15 ],
               [ 16, 17, 18 ] ] ]
print threedee[1][2][0]  ==>  prints 16

You can also look into using Numeric python
<http://numpy.sourceforge.net/>.


-- 
Cliff Crawford               http://www.people.cornell.edu/pages/cjc26/
                             print "Just another Python hacker"



More information about the Python-list mailing list