我想通过我创建的数组的每个元素。但是,我正在做一些调试,事实并非如此。以下是我目前为止的内容以及打印出的内容。阵列中的打印元素python问题
def prob_thirteen(self):
#create array of numbers 2-30
xcoords = [range(2,31)]
ycoords = []
for i in range(len(xcoords)):
print 'i:', xcoords[i]
输出:
i: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
为什么 '我' 回到我的整个阵列,而不只是第一个元素:2?我不知道为什么这会返回我的整个阵列。
啊难怪,非常感谢你! – helloworld