修改列表的元素时,可以使用for 循环结合range
n = int(input())
list_b = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
for i in range(len(list_b)):
for y in range(len(list_b[i])):
list_b[i][y] = list_b[i][y]*n
print(list_b)
标签:python,元素,list,len,列表,修改,range
来源: https://www.cnblogs.com/yinzone/p/16644143.html