为什么list.remove()的行为不符合预期?
发布于 2021-01-29 17:14:25
from pprint import *
sites = [['a','b','c'],['d','e','f'],[1,2,3]]
pprint(sites)
for site in sites:
sites.remove(site)
pprint(sites)
输出:
[['a', 'b', 'c'], ['d', 'e', 'f'], [1, 2, 3]]
[['d', 'e', 'f']]
为什么不是None或空列表[]?
关注者
0
被浏览
51