{"id":1122659,"date":"2025-01-08T19:23:23","date_gmt":"2025-01-08T11:23:23","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1122659.html"},"modified":"2025-01-08T19:23:26","modified_gmt":"2025-01-08T11:23:26","slug":"python%e5%a6%82%e4%bd%95%e7%9c%8b%e6%a8%a1%e5%9d%97%e8%af%b4%e6%98%8e%e7%9a%84-%e6%9f%a5%e6%a8%a1%e5%9d%97%e4%bd%8d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1122659.html","title":{"rendered":"python\u5982\u4f55\u770b\u6a21\u5757\u8bf4\u660e\u7684 \u67e5\u6a21\u5757\u4f4d\u7f6e"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25084433\/3b10c2fe-eef8-4685-a9e3-4419a6b7e3ba.webp\" alt=\"python\u5982\u4f55\u770b\u6a21\u5757\u8bf4\u660e\u7684 \u67e5\u6a21\u5757\u4f4d\u7f6e\" \/><\/p>\n<p><p> <strong>\u67e5\u770bPython\u6a21\u5757\u8bf4\u660e\u548c\u67e5\u627e\u6a21\u5757\u4f4d\u7f6e\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528\u5185\u7f6e\u51fd\u6570help()\u3001\u4f7f\u7528dir()\u51fd\u6570\u3001\u67e5\u770b\u6a21\u5757\u7684__doc__\u5c5e\u6027\u3001\u4f7f\u7528inspect\u6a21\u5757\u3001\u5229\u7528pydoc\u6a21\u5757\u3001\u4f7f\u7528\u7b2c\u4e09\u65b9\u5de5\u5177\u5982IPython\u3002<\/strong>\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u5e76\u63a2\u8ba8\u5982\u4f55\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d\u5229\u7528\u8fd9\u4e9b\u5de5\u5177\u63d0\u5347\u5de5\u4f5c\u6548\u7387\u3002<\/p>\n<\/p>\n<p><h2>\u4e00\u3001\u4f7f\u7528\u5185\u7f6e\u51fd\u6570help()<\/h2>\n<\/p>\n<p><h3>1.1 \u83b7\u53d6\u6a21\u5757\u8bf4\u660e<\/h3>\n<\/p>\n<p><p>Python\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5185\u7f6e\u51fd\u6570<code>help()<\/code>\u6765\u83b7\u53d6\u6a21\u5757\u3001\u51fd\u6570\u3001\u7c7b\u7b49\u5bf9\u8c61\u7684\u6587\u6863\u8bf4\u660e\u3002\u4f7f\u7528<code>help()<\/code>\u51fd\u6570\u53ef\u4ee5\u5feb\u901f\u67e5\u770b\u6a21\u5757\u7684\u7528\u9014\u53ca\u5176\u65b9\u6cd5\u3001\u7c7b\u7b49\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import math<\/p>\n<p>help(math)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u8ff0\u4ee3\u7801\u5c06\u8f93\u51famath\u6a21\u5757\u7684\u8be6\u7ec6\u8bf4\u660e\uff0c\u5305\u62ec\u6a21\u5757\u4e2d\u7684\u51fd\u6570\u548c\u5e38\u91cf\u3002<code>help()<\/code>\u51fd\u6570\u662f\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u5c24\u5176\u5728\u4f60\u4e0d\u719f\u6089\u67d0\u4e2a\u6a21\u5757\u65f6\uff0c\u53ef\u4ee5\u8fc5\u901f\u63d0\u4f9b\u5e2e\u52a9\u3002<\/p>\n<\/p>\n<p><h3>1.2 \u67e5\u627e\u6a21\u5757\u4f4d\u7f6e<\/h3>\n<\/p>\n<p><p><code>help()<\/code>\u51fd\u6570\u4e0d\u4ec5\u53ef\u4ee5\u663e\u793a\u6a21\u5757\u7684\u6587\u6863\uff0c\u8fd8\u4f1a\u663e\u793a\u6a21\u5757\u7684\u6587\u4ef6\u4f4d\u7f6e\u3002\u5728\u8f93\u51fa\u7684\u6587\u6863\u7684\u5f00\u5934\u90e8\u5206\uff0c\u4e00\u822c\u4f1a\u6709\u6a21\u5757\u7684\u6587\u4ef6\u8def\u5f84\u4fe1\u606f\uff0c\u8fd9\u5bf9\u4e8e\u67e5\u627e\u6a21\u5757\u4f4d\u7f6e\u975e\u5e38\u6709\u7528\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import requests<\/p>\n<p>help(requests)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8f93\u51fa\u7684\u6587\u6863\u4e2d\uff0c\u901a\u5e38\u4f1a\u6709\u7c7b\u4f3c<code>\/path\/to\/requests.py<\/code>\u7684\u4fe1\u606f\uff0c\u8fd9\u5c31\u662f\u6a21\u5757\u7684\u4f4d\u7f6e\u3002<\/p>\n<\/p>\n<p><h2>\u4e8c\u3001\u4f7f\u7528dir()\u51fd\u6570<\/h2>\n<\/p>\n<p><h3>2.1 \u83b7\u53d6\u6a21\u5757\u5185\u5bb9<\/h3>\n<\/p>\n<p><p><code>dir()<\/code>\u51fd\u6570\u53ef\u4ee5\u5217\u51fa\u6a21\u5757\u4e2d\u7684\u6240\u6709\u5c5e\u6027\u548c\u65b9\u6cd5\u3002\u5b83\u662f\u4e00\u4e2a\u5feb\u901f\u67e5\u770b\u6a21\u5757\u5185\u5bb9\u7684\u6709\u7528\u5de5\u5177\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import os<\/p>\n<p>print(dir(os))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u8ff0\u4ee3\u7801\u5c06\u8f93\u51faos\u6a21\u5757\u4e2d\u7684\u6240\u6709\u5c5e\u6027\u548c\u65b9\u6cd5\u7684\u5217\u8868\u3002\u867d\u7136<code>dir()<\/code>\u4e0d\u4f1a\u63d0\u4f9b\u8be6\u7ec6\u7684\u6587\u6863\u8bf4\u660e\uff0c\u4f46\u5b83\u53ef\u4ee5\u5feb\u901f\u8ba9\u4f60\u4e86\u89e3\u6a21\u5757\u7684\u7ec4\u6210\u3002<\/p>\n<\/p>\n<p><h3>2.2 \u67e5\u627e\u6a21\u5757\u4f4d\u7f6e<\/h3>\n<\/p>\n<p><p><code>dir()<\/code>\u51fd\u6570\u672c\u8eab\u5e76\u4e0d\u63d0\u4f9b\u6a21\u5757\u4f4d\u7f6e\u7684\u4fe1\u606f\uff0c\u4f46\u53ef\u4ee5\u7ed3\u5408<code>__file__<\/code>\u5c5e\u6027\u6765\u67e5\u627e\u6a21\u5757\u7684\u4f4d\u7f6e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import os<\/p>\n<p>print(os.__file__)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u8ff0\u4ee3\u7801\u5c06\u8f93\u51faos\u6a21\u5757\u7684\u4f4d\u7f6e\u3002<code>__file__<\/code>\u5c5e\u6027\u662f\u6a21\u5757\u7684\u4e00\u4e2a\u5185\u7f6e\u5c5e\u6027\uff0c\u8868\u793a\u6a21\u5757\u7684\u6587\u4ef6\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><h2>\u4e09\u3001\u67e5\u770b__doc__\u5c5e\u6027<\/h2>\n<\/p>\n<p><h3>3.1 \u83b7\u53d6\u6a21\u5757\u8bf4\u660e<\/h3>\n<\/p>\n<p><p>\u6bcf\u4e2aPython\u6a21\u5757\u3001\u51fd\u6570\u548c\u7c7b\u90fd\u6709\u4e00\u4e2a<code>__doc__<\/code>\u5c5e\u6027\uff0c\u5b58\u50a8\u5b83\u4eec\u7684\u6587\u6863\u5b57\u7b26\u4e32\u3002\u4f60\u53ef\u4ee5\u76f4\u63a5\u8bbf\u95ee\u8fd9\u4e2a\u5c5e\u6027\u6765\u83b7\u53d6\u6a21\u5757\u7684\u8bf4\u660e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<p>print(re.__doc__)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u8ff0\u4ee3\u7801\u5c06\u8f93\u51fare\u6a21\u5757\u7684\u6587\u6863\u5b57\u7b26\u4e32\u3002<code>__doc__<\/code>\u5c5e\u6027\u901a\u5e38\u4f1a\u63d0\u4f9b\u6a21\u5757\u7684\u7b80\u8981\u8bf4\u660e\u53ca\u5176\u4e3b\u8981\u7528\u9014\u3002<\/p>\n<\/p>\n<p><h3>3.2 \u67e5\u627e\u6a21\u5757\u4f4d\u7f6e<\/h3>\n<\/p>\n<p><p>\u867d\u7136<code>__doc__<\/code>\u5c5e\u6027\u4e0d\u80fd\u76f4\u63a5\u63d0\u4f9b\u6a21\u5757\u7684\u4f4d\u7f6e\uff0c\u4f46\u4f60\u53ef\u4ee5\u7ed3\u5408\u5176\u4ed6\u65b9\u6cd5\u6765\u67e5\u627e\u6a21\u5757\u7684\u4f4d\u7f6e\u3002<\/p>\n<\/p>\n<p><h2>\u56db\u3001\u4f7f\u7528inspect\u6a21\u5757<\/h2>\n<\/p>\n<p><h3>4.1 \u83b7\u53d6\u6a21\u5757\u8bf4\u660e<\/h3>\n<\/p>\n<p><p>Python\u7684<code>inspect<\/code>\u6a21\u5757\u63d0\u4f9b\u4e86\u8bb8\u591a\u6709\u7528\u7684\u51fd\u6570\uff0c\u53ef\u4ee5\u7528\u6765\u83b7\u53d6\u6a21\u5757\u3001\u51fd\u6570\u3001\u7c7b\u7b49\u5bf9\u8c61\u7684\u8be6\u7ec6\u4fe1\u606f\u3002<code>inspect.getdoc()<\/code>\u51fd\u6570\u53ef\u4ee5\u83b7\u53d6\u6a21\u5757\u7684\u6587\u6863\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import inspect<\/p>\n<p>import json<\/p>\n<p>print(inspect.getdoc(json))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u8ff0\u4ee3\u7801\u5c06\u8f93\u51fajson\u6a21\u5757\u7684\u6587\u6863\u5b57\u7b26\u4e32\u3002<code>inspect<\/code>\u6a21\u5757\u63d0\u4f9b\u4e86\u6bd4<code>__doc__<\/code>\u5c5e\u6027\u548c<code>help()<\/code>\u51fd\u6570\u66f4\u5f3a\u5927\u7684\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><h3>4.2 \u67e5\u627e\u6a21\u5757\u4f4d\u7f6e<\/h3>\n<\/p>\n<p><p><code>inspect<\/code>\u6a21\u5757\u8fd8\u63d0\u4f9b\u4e86<code>inspect.getfile()<\/code>\u51fd\u6570\uff0c\u53ef\u4ee5\u7528\u6765\u67e5\u627e\u6a21\u5757\u7684\u4f4d\u7f6e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import inspect<\/p>\n<p>import json<\/p>\n<p>print(inspect.getfile(json))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u8ff0\u4ee3\u7801\u5c06\u8f93\u51fajson\u6a21\u5757\u7684\u6587\u4ef6\u8def\u5f84\u3002<code>inspect<\/code>\u6a21\u5757\u662f\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u5c24\u5176\u5728\u9700\u8981\u83b7\u53d6\u6a21\u5757\u8be6\u7ec6\u4fe1\u606f\u65f6\u975e\u5e38\u6709\u7528\u3002<\/p>\n<\/p>\n<p><h2>\u4e94\u3001\u5229\u7528pydoc\u6a21\u5757<\/h2>\n<\/p>\n<p><h3>5.1 \u83b7\u53d6\u6a21\u5757\u8bf4\u660e<\/h3>\n<\/p>\n<p><p><code>pydoc<\/code>\u6a21\u5757\u53ef\u4ee5\u751f\u6210\u6a21\u5757\u7684HTML\u6587\u6863\u6216\u5728\u7ec8\u7aef\u4e2d\u67e5\u770b\u6587\u6863\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528<code>pydoc.render_doc()<\/code>\u51fd\u6570\u6765\u83b7\u53d6\u6a21\u5757\u7684\u6587\u6863\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pydoc<\/p>\n<p>import random<\/p>\n<p>print(pydoc.render_doc(random))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u8ff0\u4ee3\u7801\u5c06\u8f93\u51farandom\u6a21\u5757\u7684\u8be6\u7ec6\u6587\u6863\u3002<code>pydoc<\/code>\u6a21\u5757\u662fPython\u6587\u6863\u7cfb\u7edf\u7684\u4e00\u4e2a\u6838\u5fc3\u90e8\u5206\uff0c\u975e\u5e38\u9002\u5408\u751f\u6210\u548c\u67e5\u770b\u6587\u6863\u3002<\/p>\n<\/p>\n<p><h3>5.2 \u67e5\u627e\u6a21\u5757\u4f4d\u7f6e<\/h3>\n<\/p>\n<p><p><code>pydoc<\/code>\u6a21\u5757\u7684\u6587\u6863\u8f93\u51fa\u4e2d\u901a\u5e38\u4f1a\u5305\u542b\u6a21\u5757\u7684\u4f4d\u7f6e\u4fe1\u606f\uff0c\u8fd9\u4e0e<code>help()<\/code>\u51fd\u6570\u7c7b\u4f3c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pydoc<\/p>\n<p>import random<\/p>\n<p>print(pydoc.render_doc(random))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8f93\u51fa\u7684\u6587\u6863\u4e2d\uff0c\u4f1a\u5305\u542b\u6a21\u5757\u7684\u6587\u4ef6\u8def\u5f84\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><h2>\u516d\u3001\u4f7f\u7528\u7b2c\u4e09\u65b9\u5de5\u5177\u5982IPython<\/h2>\n<\/p>\n<p><h3>6.1 \u83b7\u53d6\u6a21\u5757\u8bf4\u660e<\/h3>\n<\/p>\n<p><p>IPython\u662f\u4e00\u4e2a\u589e\u5f3a\u7684Python\u4ea4\u4e92\u73af\u5883\uff0c\u63d0\u4f9b\u4e86\u8bb8\u591a\u6709\u7528\u7684\u529f\u80fd\u3002\u4f7f\u7528IPython\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7<code>?<\/code>\u64cd\u4f5c\u7b26\u6765\u67e5\u770b\u6a21\u5757\u7684\u6587\u6863\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<p>np?<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728IPython\u4e2d\u8f93\u5165\u4e0a\u8ff0\u4ee3\u7801\uff0c\u5c06\u8f93\u51fanumpy\u6a21\u5757\u7684\u8be6\u7ec6\u6587\u6863\u3002IPython\u63d0\u4f9b\u4e86\u975e\u5e38\u53cb\u597d\u7684\u4ea4\u4e92\u754c\u9762\uff0c\u4f7f\u5f97\u67e5\u770b\u6587\u6863\u53d8\u5f97\u66f4\u52a0\u65b9\u4fbf\u3002<\/p>\n<\/p>\n<p><h3>6.2 \u67e5\u627e\u6a21\u5757\u4f4d\u7f6e<\/h3>\n<\/p>\n<p><p>\u5728IPython\u4e2d\uff0c\u4f60\u8fd8\u53ef\u4ee5\u4f7f\u7528<code>??<\/code>\u64cd\u4f5c\u7b26\u6765\u67e5\u770b\u6a21\u5757\u7684\u6e90\u4ee3\u7801\u53ca\u5176\u6587\u4ef6\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<p>np??<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u8ff0\u4ee3\u7801\u5c06\u5728IPython\u4e2d\u8f93\u51fanumpy\u6a21\u5757\u7684\u6e90\u4ee3\u7801\u53ca\u5176\u6587\u4ef6\u8def\u5f84\u3002\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u529f\u80fd\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u6df1\u5165\u4e86\u89e3\u6a21\u5757\u7684\u5b9e\u73b0\u3002<\/p>\n<\/p>\n<p><h2>\u603b\u7ed3<\/h2>\n<\/p>\n<p><p>\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u67e5\u770bPython\u6a21\u5757\u7684\u8bf4\u660e\u548c\u67e5\u627e\u6a21\u5757\u7684\u4f4d\u7f6e\uff0c\u5305\u62ec\u4f7f\u7528<code>help()<\/code>\u51fd\u6570\u3001<code>dir()<\/code>\u51fd\u6570\u3001<code>__doc__<\/code>\u5c5e\u6027\u3001<code>inspect<\/code>\u6a21\u5757\u3001<code>pydoc<\/code>\u6a21\u5757\u4ee5\u53ca\u7b2c\u4e09\u65b9\u5de5\u5177\u5982IPython\u3002\u6bcf\u79cd\u65b9\u6cd5\u90fd\u6709\u5176\u72ec\u7279\u7684\u4f18\u52bf\u548c\u9002\u7528\u573a\u666f\uff0c<strong>\u4f7f\u7528\u8fd9\u4e9b\u5de5\u5177\u53ef\u4ee5\u6781\u5927\u5730\u63d0\u5347\u4f60\u7684\u5f00\u53d1\u6548\u7387<\/strong>\u3002\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u80fd\u591f\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u7406\u89e3\u548c\u4f7f\u7528Python\u6a21\u5757\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u67e5\u770b\u6a21\u5757\u7684\u6587\u6863\u8bf4\u660e\uff1f<\/strong><br \/>\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u5185\u7f6e\u7684<code>help()<\/code>\u51fd\u6570\u6765\u67e5\u770b\u6a21\u5757\u7684\u6587\u6863\u8bf4\u660e\u3002\u5728Python\u7684\u4ea4\u4e92\u5f0f\u73af\u5883\u4e2d\uff0c\u8f93\u5165<code>help(\u6a21\u5757\u540d)<\/code>\uff0c\u4f8b\u5982<code>help(math)<\/code>\uff0c\u5c06\u4f1a\u663e\u793a\u8be5\u6a21\u5757\u7684\u8be6\u7ec6\u6587\u6863\uff0c\u5305\u62ec\u51fd\u6570\u3001\u7c7b\u53ca\u5176\u7528\u9014\u7684\u8bf4\u660e\u3002\u6b64\u5916\uff0c\u4f7f\u7528<code>__doc__<\/code>\u5c5e\u6027\u4e5f\u53ef\u4ee5\u67e5\u770b\u6a21\u5757\u7684\u7b80\u8981\u8bf4\u660e\uff0c\u4f8b\u5982<code>print(math.__doc__)<\/code>\u3002<\/p>\n<p><strong>\u5982\u4f55\u627e\u5230Python\u6a21\u5757\u7684\u5b89\u88c5\u4f4d\u7f6e\uff1f<\/strong><br \/>\u8981\u67e5\u627e\u5df2\u5b89\u88c5\u6a21\u5757\u7684\u8def\u5f84\uff0c\u53ef\u4ee5\u4f7f\u7528<code>\u6a21\u5757\u540d.__file__<\/code>\u5c5e\u6027\u3002\u4f8b\u5982\uff0c\u8f93\u5165<code>print(math.__file__)<\/code>\u5c06\u8fd4\u56de<code>math<\/code>\u6a21\u5757\u7684\u5b89\u88c5\u4f4d\u7f6e\u3002\u8be5\u8def\u5f84\u901a\u5e38\u6307\u5411\u4e00\u4e2a<code>.py<\/code>\u6587\u4ef6\u6216\u8005\u662f\u4e00\u4e2a<code>.so<\/code>\u6216<code>.pyd<\/code>\u6587\u4ef6\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u6a21\u5757\u7684\u5b9e\u73b0\u65b9\u5f0f\u3002<\/p>\n<p><strong>\u662f\u5426\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u67e5\u770b\u6a21\u5757\u7684\u8bf4\u660e\u548c\u4f4d\u7f6e\uff1f<\/strong><br \/>\u662f\u7684\uff0c\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u4f7f\u7528Python\u7684\u4ea4\u4e92\u6a21\u5f0f\u6216\u811a\u672c\u6765\u67e5\u770b\u6a21\u5757\u7684\u6587\u6863\u548c\u4f4d\u7f6e\u3002\u5728\u547d\u4ee4\u884c\u4e2d\u542f\u52a8Python\u540e\uff0c\u4f7f\u7528<code>import \u6a21\u5757\u540d<\/code>\u6765\u5bfc\u5165\u6a21\u5757\uff0c\u7136\u540e\u53ef\u4ee5\u4f7f\u7528<code>help(\u6a21\u5757\u540d)<\/code>\u548c<code>\u6a21\u5757\u540d.__file__<\/code>\u6765\u83b7\u53d6\u76f8\u5173\u4fe1\u606f\u3002\u8fd9\u79cd\u65b9\u6cd5\u4fbf\u4e8e\u5728\u4e0d\u9700\u8981\u7f16\u5199\u590d\u6742\u4ee3\u7801\u7684\u60c5\u51b5\u4e0b\u5feb\u901f\u8bbf\u95ee\u6a21\u5757\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u67e5\u770bPython\u6a21\u5757\u8bf4\u660e\u548c\u67e5\u627e\u6a21\u5757\u4f4d\u7f6e\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528\u5185\u7f6e\u51fd\u6570help()\u3001\u4f7f\u7528dir()\u51fd\u6570\u3001\u67e5\u770b\u6a21\u5757\u7684__ [&hellip;]","protected":false},"author":3,"featured_media":1122665,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1122659"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1122659"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1122659\/revisions"}],"predecessor-version":[{"id":1122667,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1122659\/revisions\/1122667"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1122665"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1122659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1122659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1122659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}