How to initialize an array with a large number of members ?
David
David
Wed Dec 31 11:10:21 EST 2008
Thanks to those who have helped a beginner in
Python. Using version 3.0
# script23
from array import array
< see failed initialization attempts below >
tally = array('H',for i in range(75) : [0])
tally = array('H',[for i in range(75) : 0])
tally = array('H',range(75) : [0])
tally = array('H',range(75) [0])
Above give either Syntax error or TypeError
All examples of sequences in docs show only
a few members being initialized. Array doc
says an iterator can be used, but doen't show
how. What would you do for a 2 dimensional
array ? Incorporate c code ?
The online docs are clearly insufficient for a
novice. Have ordered Summerfields new book.
More information about the Python-list
mailing list