对Python 内建函数和保留字详解

yipeiwu_com5年前Python基础

保留字:

In [4]: import keyword

In [5]: keyword.kwlist
Out[5]: 
['False',
 'None',
 'True',
 'and',
 'as',
 'assert',
 'break',
 'class',
 'continue',
 'def',
 'del',
 'elif',
 'else',
 'except',
 'finally',
 'for',
 'from',
 'global',
 'if',
 'import',
 'in',
 'is',
 'lambda',
 'nonlocal',
 'not',
 'or',
 'pass',
 'raise',
 'return',
 'try',
 'while',
 'with',
 'yield']

其他可用:

A:

abs
abstractmethod
all
and
any
apply
as
ascii (python3新增)
assert

B:

basestring(python3已删除)
bin
bool
break

buffer(python3已删除)
bytearray
bytes

C:

callable
class
classmethod
compile
complex

D:

def
del
delattr
dict
dir
divmod

E:

elif
else
eval
except
exec
execfile(python3 删除)

F:

filter
finally
float
for
format
from
frozenset

G:

getattr
global
globals

H:

hasattr
hash
help
hex

I:

id
if
import
in
input
int
is
isinstance
isubclass
iter

L:

lambda
len
list
locals

M:

map
max
memoryview
min

N:

next
nonlocal (python3新增)
not

O:

object
oct
open
or
ord

P:

pass
pow
print
property

R:

raise
range
repr
return
reload
reversed
round

S:

set
setattr
slice
sorted
str
sum
super

T:

try
tuple
typle

V:

vars

W:

while
with

X:

xrange (python3 已删除)

Y:

yield

Z:

zip

欢迎补充~

以上这篇对Python 内建函数和保留字详解就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

Python语言描述最大连续子序列和

求最大连续子序列的和是一个很经典很古老的面试题了,记得在刚毕业找工作面试那会也遇到过同款问题。今儿突然想起来,正好快到毕业季,又该是苦逼的应届生们各种面试的时候到了,就给写了一些小代码解...

详谈Python 窗体(tkinter)表格数据(Treeview)

如下所示: import tkinter from tkinter import ttk #导入内部包 win=tkinter.Tk() tree=ttk.Treeview(wi...

详解Django项目中模板标签及模板的继承与引用(网站中快速布置广告)

详解Django项目中模板标签及模板的继承与引用(网站中快速布置广告)

Django项目中模板标签及模板的继承与引用 常见模板标签 {% static %} {% for x in range(x) %}{% endfor %} 循环的序号{% forl...

妙用itchat! python实现久坐提醒功能

本文实例为大家分享了python久坐提醒的具体实现代码,供大家参考,具体内容如下 #!/usr/bin/envy python3 #-*- coding:utf-8 -*- impo...

提升Python程序性能的7个习惯

掌握一些技巧,可尽量提高Python程序性能,也可以避免不必要的资源浪费。 1、使用局部变量 尽量使用局部变量代替全局变量:便于维护,提高性能并节省内存。 使用局部变量替换模块名字空间中...