Python 内置函数

python一些内置函数

查看Python内的所有内置函数

1 dir(__builtins__)

会有如下类似输出:

 

 

 

enumerate  (列举、枚举)

1 >>>seasons = ['Spring', 'Summer', 'Fall', 'Winter']
2 >>>list(enumerate(seasons))
3 [(0, 'Spring'), (1, 'Summer'), (2, 'Fall'), (3, 'Winter')]
4 >>>list(enumerate(seasons, start=1))       # 小标从 1 开始
5 [(1, 'Spring'), (2, 'Summer'), (3, 'Fall'), (4, 'Winter')]

 

posted @ 2019-05-16 21:38  Seven丨Pounds  阅读(231)  评论(0编辑  收藏  举报