小编joe*_*joe的帖子

参考列表的一部分 - Python

如果我在python中有一个列表,我如何创建对列表的一部分的引用?例如:

myList = ["*", "*", "*",  "*", "*", "*", "*", "*", "*"]

listPart = myList[0:7:3] #This makes a new list, which is not what I want

myList[0] = "1"

listPart[0]

"1"
Run Code Online (Sandbox Code Playgroud)

这是可能的,如果是这样,我将如何编码?

干杯,乔

python list

12
推荐指数
2
解决办法
9220
查看次数

标签 统计

list ×1

python ×1