使用Python切片赋值

解释器下运行以下代码:
list1 = [4,5,6,7,8,9] list1[2:5] = ['a','b','c']

结果是:[4, 5, 'a', 'b', 'c', 9]

 

猜你喜欢

转载自www.cnblogs.com/IT-kingman/p/11546466.html