>>> # Replace some items:
... a[0:2= [112]
>>> a
[
1121231234]
>>> # Remove some:
... a[0:2= []
>>> a
[
1231234]
>>> # Insert some:
... a[1:1= ['bletch''xyzzy']
>>> a
[
123'bletch''xyzzy'1234]
>>> # Insert (a copy of) itself at the beginning
>>> a[:0] = a
>>> a
[
123'bletch''xyzzy'1234123'bletch''xyzzy'1234]
>>> # Clear the list: replace all items with an empty list
>>> a[:] = []
>>> a
[]

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-25
  • 2022-12-23
  • 2023-03-18
猜你喜欢
  • 2022-02-24
  • 2022-12-23
  • 2021-07-22
  • 2021-08-01
  • 2022-02-16
  • 2021-07-05
  • 2021-07-04
相关资源
相似解决方案