【发布时间】:2018-08-30 22:26:19
【问题描述】:
如何获取 list code 元素的值?
def test(argu):
print(argu)
code = [5,10,15]
length =len(code)
for i in range(0,length):
test("code[%d]" %i)
预期输出:
5
10
15
实际输出:
code[0]
code[1]
code[2]
【问题讨论】:
-
我很惊讶你知道这么多 python 却不知道你可以做
test(code[i]) -
哎呀!这么傻的问题!
标签: python python-3.x