<input type="text" style="width: ...
在使用python3时,有【并行迭代】与【按索引迭代】,并行迭代相对来说好理解,现在介绍下【按索引迭代】。...names = ["anne","beth","george","damon","bob"]ages = [12,45,32,102,101,103]# names 与 ages 列表元素可以不等同,按数量少的进行对应...按索引迭代案例按索引迭代方式一strings = ["Alice","Bob","Nick"]# strings[1] = "leo" #测试给列表添加元素后,的效果# print(strings)index... if "ob" in string: strings[index] = "Tom" # 将含有“ob”的元素,替换为Tom index += 1print(strings)按索引迭代方式二 |