What does the [:] do?

后端 未结 0 1161
遥遥无期
遥遥无期 2021-02-10 12:07
li = [\'random values\', True]
li[:] = \'some text\'

If I print this out, the list becomes [\'s\', \'o\', \'m\', \'e\', \' \', \'t\', \'e\', \'x\'

相关标签:
回答
  • 消灭零回复
提交回复
热议问题