新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
創(chuàng)新互聯(lián)Python教程:Python中關(guān)鍵字有多少個(gè)?
python中關(guān)鍵詞有多少個(gè)?Python中關(guān)鍵詞目前有31個(gè),可以利用Python的內(nèi)置的keyword模塊進(jìn)行輸出查看。

創(chuàng)新互聯(lián)建站網(wǎng)站建設(shè)10余年堅(jiān)持,服務(wù)企業(yè)網(wǎng)站設(shè)計(jì)、成都響應(yīng)式網(wǎng)站建設(shè)等網(wǎng)站建設(shè)服務(wù)。1000多家企業(yè)的合作經(jīng)驗(yàn),幫助我們?yōu)榉?wù)企業(yè)不斷提升價(jià)值。為企業(yè)建設(shè)開發(fā)網(wǎng)站和維護(hù),主推個(gè)性化定制型網(wǎng)站設(shè)計(jì)
keyword模塊
Help on module keyword: NAME keyword - Keywords (from "graminit.c") FILE /usr/lib64/python2.6/keyword.py DESCRIPTION This file is automatically generated; please don't muck it up! To update the symbols in this file, 'cd' to the top directory of the python source tree after building the interpreter and run: python Lib/keyword.py FUNCTIONS iskeyword = __contains__(...) x.__contains__(y) y in x. DATA __all__ = ['iskeyword', 'kwlist'] kwlist = ['and', 'as', 'assert', 'break', 'class', 'continue', 'def', ...
得到python的關(guān)鍵字列表:
>>> keyword.kwlist ['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield']
更多相關(guān)內(nèi)容:python關(guān)鍵字
判斷字符串是否是python的關(guān)鍵字
>>> keyword.iskeyword('and')
True
>>>
>>> keyword.iskeyword('has')
False 當(dāng)前文章:創(chuàng)新互聯(lián)Python教程:Python中關(guān)鍵字有多少個(gè)?
文章路徑:http://fisionsoft.com.cn/article/dpiocde.html


咨詢
建站咨詢
