Python3 List列表常规用法介绍
2020-06-04 04:54
302 查看
本文内容参考网址:https://www.runoob.com/python3/python3-string.html
如果有问题,请联系博主删除或修改,谢谢!
List常用函数 |
||
1 | len(list) | 列表元素个数 |
2 | max(list) | 返回列表元素最大值 |
3 | min(list) | 返回列表元素最小值 |
4 | list(seq) | 将元组转换为列表 |
List常用内建函数 |
||
1 | list.append(obj) | 在列表末尾添加新的对象 |
2 | list.count(obj) | 统计某个元素在列表中出现的次数 |
3 | list.extend(seq) | 在列表末尾一次性追加另一个序列中的多个值(用新列表扩展原来的列表) |
4 | list.index(obj) | 从列表中找出某个值第一个匹配项的索引位置 |
5 | list.insert(index, obj) | 将对象插入列表 |
6 | list.pop([index=-1]) | 移除列表中的一个元素(默认最后一个元素),并且返回该元素的值 |
7 | list.remove(obj) | 移除列表中某个值的第一个匹配项 |
8 | list.reverse() | 反向列表中元素 |
9 | list.sort( key=None, reverse=False) | 对原列表进行排序 |
10 | list.clear() | 清空列表 |
11 | list.copy() | 复制列表 |
相关文章推荐
- python 序列类型以及list(列表) 和 tuple(元组)详解 以及range的用法
- python基础学习——列表(list), 元祖(tuple), 字典(dict), 字符串(string), 集合(set) 介绍及相互转换
- python之列表(list)的使用方法介绍
- Python中数组,列表:冒号的灵活用法介绍(np数组,列表倒序)
- python之列表(list)的使用方法介绍
- python基础数据结构——列表(list), 元祖(tuple), 字典(dict), 字符串(string), 集合(set) 介绍及相互转换
- Python中list列表的一些进阶使用方法介绍
- Python 列表list使用介绍
- Python 列表list使用介绍
- python 列表list 元组tuple 字典dict 集合set 介绍
- python list(列表)操作用法总结
- python中的 list (列表)append()方法 与extend()方法的用法 和 区别
- Python中list列表的一些进阶使用方法介绍
- Python中map()函数用法-对列表中每个元素做相同操作,并返回list
- python 列表list 元组tuple 字典dict 集合set 介绍
- python列表的基本用法介绍
- python之列表(list)的使用方法介绍
- 举例讲解Python中的list列表数据结构用法
- python list(列表)操作用法总结
- Python列表list内建函数用法实例分析【insert、remove、index、pop等】