Arrays? (Or lists if you prefer)
Hakusa at gmail.com
Hakusa at gmail.com
Mon Oct 23 02:47:45 EDT 2006
Andrea Griffini wrote:
> Neil Cerutti wrote:
>
> > >>> b =[range(2), range(2)]
>
> I often happened to use
>
> b = [[0] * N for i in xrange(N)]
>
> an approach that can also scale up in dimensions;
> for example for a cubic NxNxN matrix:
>
> b = [[[0] * N for i in xrange(N)]
> for j in xrange(N)]
>
> Andrea
What's the difference between xrange and range?
More information about the Python-list
mailing list