python中修改列表元素的值
>>> a = ["aaa","bbb","ccc","ddd"]
>>> a[1] = "xxx" ## 修改第二个元素
>>> a
['aaa', 'xxx', 'ccc', 'ddd']
>>> a[2:4] = ["mmm","nnn"] ## 修改第三和第四个元素
>>> a
['aaa', 'xxx', 'mmm', 'nnn']
>>> a = ["aaa","bbb","ccc","ddd","eee","fff","ggg","hhh"]
>>> len(a)
8
>>> a[::2]
['aaa', 'ccc', 'eee', 'ggg']
>>> a[::2] = ["111","222","333","444"]
>>> a
['111', 'bbb', '222', 'ddd', '333', 'fff', '444', 'hhh']
>>> a[::-2]
['hhh', 'fff', 'ddd', 'bbb']
>>> a[::-2] = ["xxx","yyy","zzz","000"]
>>> a
['111', '000', '222', 'zzz', '333', 'yyy', '444', 'xxx']