Python中修改列表每一项
Python中修改列表每一项
Python有时候需要修改列表元素的值,这里提供几种方法
1.使用列表长度
def chang_magic(olds):
for i in range(0,len(olds)):
olds[i] = 'the Great ' + olds[i];
2.使用map函数
def double_list(x):
n = [3, 5, 7]
def double_list(x):
return x * 2
map(double_l
原创
2020-12-07 16:53:57 ·
666 阅读 ·
0 评论