Python论坛  - 讨论区

标题:Re: [python-chinese] 问关于三维数组在python中的 表达

2005年05月01日 星期日 12:27

jawbreaker jawbreaker at 163.com
Sun May 1 12:27:22 HKT 2005

谢谢William Wu 和 Qiangning Hong。

原来可以这么简单……

William Wu wrote:

>[[[1]*12]*12]*12
>
>Qiangning Hong wrote:
>
>>On 5/1/05, *Qiangning Hong* <hongqn at gmail.com
>>hongqn at gmail.com>> wrote:
>>
>>    On 5/1/05, *jawbreaker* <jawbreaker at 163.com
>>    jawbreaker at 163.com>> wrote:
>>
>>        在C中,我们会这样定义和初始化这样一个三维数组:
>>        int Table[12][12][12];
>>        for(i=0;i<12;i++)
>>        for(j=0;j<12;j++)
>>        for(k=0;k<12;k++)
>>        Table[i][j][k]=1;
>>
>>
>>    Table = [[[[1] * 12] for x in range(12)] for x in range(12)]
>>
>>
>>不好意思,写错了,应该是:
>>Table = [ [ [1] * 12 for x in range(12) ] for x in range(12) ]
>>
>>-- 
>>Qiangning Hong
>>Get Firefox!
>><http://www.spreadfirefox.com/?q=affiliates&id=67907&t=1
>><http://www.spreadfirefox.com/?q=affiliates&id;=67907&t;=1>>
>>
>>------------------------------------------------------------------------
>>
>>_______________________________________________
>>python-chinese list
>>python-chinese at lists.python.cn
>>http://python.cn/mailman/listinfo/python-chinese
>> 
>>
>>_______________________________________________
>>python-chinese list
>>python-chinese at lists.python.cn
>>http://python.cn/mailman/listinfo/python-chinese
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050501/71cb35a6/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号