mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-08 06:55:36 +08:00
1 line
1.7 KiB
HTML
1 line
1.7 KiB
HTML
<div class="body" role="main"><div class="section" id="module-keyword"><h1><span class="yiyi-st" id="yiyi-10">32.6. <a class="reference internal" href="#module-keyword" title="keyword: Test whether a string is a keyword in Python."><code class="xref py py-mod docutils literal"><span class="pre">关键字</span></code></a> — — 测试 Python 关键字 </span></h1><p><span class="yiyi-st" id="yiyi-11"><strong>源程序代码︰</strong><a class="reference external" href="https://hg.python.org/cpython/file/3.5/Lib/keyword.py">Lib/keyword.py</a></span></p><p><span class="yiyi-st" id="yiyi-12">这个模块允许一个 Python 程序来确定一个字符串是否是一个关键字。</span></p><dl class="function"><dt id="keyword.iskeyword"><span class="yiyi-st" id="yiyi-13"><code class="descclassname">关键字:</code><code class="descname">iskeyword</code><span class="sig-paren">(</span> <em>s</em> <span class="sig-paren">)</span></span></dt><dd><p><span class="yiyi-st" id="yiyi-14">如果 <em>s</em> 是一个 Python 关键字则返回True。</span></p></dd></dl><dl class="data"><dt id="keyword.kwlist"><span class="yiyi-st" id="yiyi-15"><code class="descclassname">关键字:</code><code class="descname">kwlist</code></span></dt><dd><p><span class="yiyi-st" id="yiyi-16">包含定义为解释器的所有关键字的序列。</span><span class="yiyi-st" id="yiyi-17">如果任何关键字被定义为仅当特定的<a class="reference internal" href="__future__.html#module-__future__" title="__future__: Future statement definitions"><code class="xref py py-mod docutils literal"><span class="pre">__future__</span></code></a>语句生效时才被激活,则这些关键字也将被包括。</span></p></dd></dl></div></div> |