且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

你是怎么做数组的

更新时间:2023-09-28 23:18:58

Tom,


在使用iMatrix [index]之前,你必须告诉python使用iMatrix

作为数组。你将使用iMatrix = [] *在循环之外。


iMatrix = []

而索引< majorlop1:#其余的循环语句


既然你是新手,请看一下Python教程给你

开始。
http://docs.python.org/tut/tut.html


谢谢,

-Kartic

Tom,

Before you use iMatrix[index], you have to tell python to use iMatrix
as an array. You will do that using iMatrix = [] *outside* the loop.

iMatrix = []
while index < majorlop1: # rest of the loop statements

Since you are new, please take a look at the Python tutorial to get you
started.
http://docs.python.org/tut/tut.html

Thanks,
-Kartic


,它被称为 ;列表与QUOT;用Python的说法。

and it is called a "List" in Python parlance.


2005年2月1日星期二10:52:45 -0800,Thomas Bunce< tb **** @ mac.com&gt ;写道:
On Tue, 01 Feb 2005 10:52:45 -0800, Thomas Bunce <tb****@mac.com> wrote:
我是Pyton的新手,我正在从书中学习而不是上课
所以请原谅我慢慢来

以下不起作用我得到一个错误of File
" Matrix [index] = k
NameError:name''iMatrix''未定义"

而index< majorlop1:
index = index + 1
k = random.choice(listvalues)+ 1
iMatrix [index] = k

书的声明
数组(typecode,初始化程序)对我来说如何为阵列的组织名称
留下了重要的东西。

谢谢你汤姆
-
http://mail.python .org / mailman / listinfo / python-list
I am new at Pyton and I am learning from book not classes
so please forgive my being slow

The below does not work I get an Error of File
"Matrix[index] = k
NameError: name ''iMatrix'' is not defined"

while index < majorlop1:
index = index + 1
k = random.choice(listvalues) + 1
iMatrix[index] = k

The book statement of
array(typecode, initializer) does not make sence
to me how it henerates ore relaes to the org name
for the array.

Thank You
Tom
--
http://mail.python.org/mailman/listinfo/python-list



与任何其他变量一样,您需要在使用之前声明iMatrix:


Like any other variable, you need to declare iMatrix before you use it: