On Fri, Jul 25, 2008 at 7:35 PM, Mike Meisner <[EMAIL PROTECTED]> wrote:
> Do you happen to know if there is an efficient way to initialize a  list
> like this without explicitly writing out each element?

You can make a copy of the inner list each time through the loop:
    IP = []
    temp = [[0, 0, 0],[0, 0, 0],[0, 0, 0]]
    # initialize to zero
    for i in range(20):
        IP.append(list(temp))

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to