为啥倒叙是-3 却把‘candy’替换掉了?
L = ['Alice', 'Bob', 'Candy', 'David', 'Ellena'] L[-3] = 'Canlina' print(L)
结果是:['Alice', 'Bob', 'Canlina', 'David', 'Ellena'] 为啥把‘candy’替换了?按照下标来数,倒叙从右向左,从0开始应该替换掉‘Bob’啊?谁能解释一下,我比较愚钝
L = ['Alice', 'Bob', 'Candy', 'David', 'Ellena'] L[-3] = 'Canlina' print(L)
结果是:['Alice', 'Bob', 'Canlina', 'David', 'Ellena'] 为啥把‘candy’替换了?按照下标来数,倒叙从右向左,从0开始应该替换掉‘Bob’啊?谁能解释一下,我比较愚钝
2022-02-22
举报