- list的遍历问题:
只有用下标访问list才能修改list里面的值
-
# coding=gbk # 只有用下标访问list才能修改list里面的值 list = [-1, 2, 5, -8] for i in list: i += 8 print(list) for i in range(0, len(list)): list[i] += 8 print(list)
原文地址:https://www.cnblogs.com/jkn1234/p/8903202.html
时间: 2024-10-09 03:05:56