在循环列表的同时记住列表的序列的一种方法
# 调用 enumerate 函数, 这个函数可以迭代出索引 - 值对, 其中索引是自动提供的 for index, string in enumerate(strings): if 'xxx' in string: strings[index] = '[censored]'
来源: http://www.bubuko.com/infodetail-2601464.html