保留字,不可以當作其他用途使用,尤其是變數名稱命名,以避免衝突。如果記不起來,Python 提供一個快速查詢指令:
〉〉〉 import keyword
〉〉〉 keyword.kwlist
['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']
2018年3月6日 星期二
2018年3月5日 星期一
Python 內建函式
受歡迎的 Python 其內建函式如下,日後再個別範例解說:
abs()
|
dict()
|
hex()
|
all()
|
dir()
|
help()
|
any()
|
divmod()
|
id()
|
ascii()
|
enumerate()
|
input()
|
bin()
|
eval()
|
int()
|
bool()
|
exec()
|
isinstance()
|
bytearray()
|
filter()
|
issubclass()
|
bytes()
|
float()
|
iter()
|
callable()
|
format()
|
len()
|
chr()
|
frozenset()
|
list()
|
classmethod()
|
getattr()
|
locals()
|
compile()
|
globals()
|
map()
|
complex()
|
hasattr()
|
max()
|
delattr()
|
hash()
|
min()
|
memoryview()
|
sorted()
|
next()
|
staticmethod()
|
object()
|
str()
|
oct()
|
sum()
|
ord()
|
open()
|
super()
|
tuple()
|
pow()
|
type()
|
range()
|
print()
|
vars()
|
__import__()
|
property()
|
zip()
|
repr()
|
setattr()
|
reversed()
|
slice()
|
round()
|
set()
|
|
訂閱:
文章 (Atom)