Newbie: How do I implement an 2 element integer array in Python.?
Aahz Maruch
aahz at panix.com
Wed Oct 11 12:54:32 EDT 2000
In article <7U%E5.61379$g6.27618408 at news2.rdc2.tx.home.com>,
Rainer Deyke <root at rainerdeyke.com> wrote:
><jbranthoover at my-deja.com> wrote in message
>news:8s1s48$89a$1 at nnrp1.deja.com...
>>
>> What is the syntax for creating a 2 element integer array? I
>> have looked at the Array Module documentation, but I am afraid that I
>> dont quite understand it. In Basic I would do something like:
>>
>> Dim MyArray(100,16)
>
>In Python 1.6 and above, list comprehensions are probably your best bet.
>
>MyArray = [[0 for i in range(16)] for j in range(100)]
>MyArray[5][4] = 7
Why zero rather than None?
--
--- Aahz (Copyright 2000 by aahz at pobox.com)
Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
'Gender' isn't a definition, it's a heuristic. --Aahz
More information about the Python-list
mailing list