![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
list
devops_sre
道
展开
-
python3中几种方法去掉列中的最后一个元素
#### 前言 去除列表中的最后一个元素 #### 方法 ##### 变量 confirm = ['The', 'greatest', 'truths', 'are', 'the', 'simplest'] ##### 法1: list.pop() ``` >>> confirm.pop() 'simplest' >>> confirm ['The', 'greatest', 'truths', 'are', 'the'] ``` ...原创 2020-05-30 14:52:51 · 1429 阅读 · 0 评论 -
python3中list的使用
#### 前言 xxx #### index()方法 查找索引位置 ``` >>> a = [1, 2, 3] >>> a.index(2) a.index(2) 1 ``` #### pop()方法 移除指定索引位置的列表元素 ``` >>> a = [1, 2, 3] >>> a.pop(1...原创 2020-04-18 17:56:53 · 131 阅读 · 0 评论