{"id":1012659,"date":"2024-12-27T11:41:04","date_gmt":"2024-12-27T03:41:04","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1012659.html"},"modified":"2024-12-27T11:41:08","modified_gmt":"2024-12-27T03:41:08","slug":"python%e4%b8%ad%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8%e5%b8%ae%e5%8a%a9","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1012659.html","title":{"rendered":"python\u4e2d\u5982\u4f55\u4f7f\u7528\u5e2e\u52a9"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25090354\/d79ff64a-b41c-4ec8-a0e3-1a5a27b293be.webp\" alt=\"python\u4e2d\u5982\u4f55\u4f7f\u7528\u5e2e\u52a9\" \/><\/p>\n<p><p> \u5728Python\u4e2d\uff0c\u6709\u591a\u79cd\u65b9\u5f0f\u53ef\u4ee5\u83b7\u53d6\u5e2e\u52a9\u4fe1\u606f\u4ee5\u4fbf\u66f4\u597d\u5730\u7406\u89e3\u548c\u4f7f\u7528Python\u7684\u5404\u79cd\u529f\u80fd\u548c\u6a21\u5757\u3002\u4e3b\u8981\u7684\u65b9\u6cd5\u5305\u62ec<strong>\u4f7f\u7528\u5185\u7f6e\u7684<code>help()<\/code>\u51fd\u6570\u3001\u67e5\u770b\u5b98\u65b9\u6587\u6863\u3001\u4f7f\u7528IDE\u81ea\u5e26\u7684\u5e2e\u52a9\u529f\u80fd\u3001\u501f\u52a9\u5728\u7ebf\u8d44\u6e90<\/strong>\u3002\u4e0b\u9762\u6211\u4eec\u5c06\u91cd\u70b9\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528<code>help()<\/code>\u51fd\u6570\uff0c\u5e76\u5bf9\u5176\u8fdb\u884c\u8be6\u7ec6\u89e3\u91ca\u3002<\/p>\n<\/p>\n<p><p><strong>\u9996\u5148\uff0c\u5185\u7f6e\u7684<code>help()<\/code>\u51fd\u6570\u662fPython\u4e2d\u6700\u76f4\u63a5\u548c\u4fbf\u6377\u7684\u5e2e\u52a9\u83b7\u53d6\u65b9\u5f0f\u3002\u6211\u4eec\u53ef\u4ee5\u5728\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668\u4e2d\u8c03\u7528<code>help()<\/code>\u51fd\u6570\u6765\u83b7\u53d6\u5173\u4e8e\u6a21\u5757\u3001\u7c7b\u3001\u51fd\u6570\u6216\u53d8\u91cf\u7684\u8be6\u7ec6\u4fe1\u606f<\/strong>\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<code>help(str)<\/code>\u53ef\u4ee5\u67e5\u770b\u5173\u4e8e\u5b57\u7b26\u4e32\u5bf9\u8c61\u7684\u6240\u6709\u65b9\u6cd5\u548c\u63cf\u8ff0\u3002<code>help()<\/code>\u51fd\u6570\u4f1a\u663e\u793a\u5bf9\u8c61\u7684\u6587\u6863\u5b57\u7b26\u4e32\uff08docstring\uff09\uff0c\u8fd9\u5bf9\u4e8e\u7406\u89e3\u51fd\u6570\u7684\u4f5c\u7528\u548c\u7528\u6cd5\u975e\u5e38\u6709\u5e2e\u52a9\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4f7f\u7528<code>help()<\/code>\u51fd\u6570<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u67e5\u770b\u6a21\u5757\u3001\u7c7b\u6216\u51fd\u6570\u7684\u6587\u6863<\/strong><\/p>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c<code>help()<\/code>\u51fd\u6570\u662f\u7528\u4e8e\u67e5\u770b\u6a21\u5757\u3001\u7c7b\u6216\u51fd\u6570\u7684\u8be6\u7ec6\u6587\u6863\u7684\u5f3a\u5927\u5de5\u5177\u3002\u5b83\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5feb\u901f\u7406\u89e3\u67d0\u4e2a\u5bf9\u8c61\u7684\u529f\u80fd\u548c\u7528\u6cd5\u3002\u53ea\u9700\u5728Python\u89e3\u91ca\u5668\u4e2d\u8f93\u5165<code>help(\u5bf9\u8c61\u540d)<\/code>\uff0c\u5c31\u53ef\u4ee5\u83b7\u5f97\u8be5\u5bf9\u8c61\u7684\u6587\u6863\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff0c\u8981\u67e5\u770b\u5b57\u7b26\u4e32\u65b9\u6cd5\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">help(str)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u663e\u793a\u5173\u4e8e<code>str<\/code>\u7c7b\u7684\u6240\u6709\u65b9\u6cd5\u53ca\u5176\u7528\u6cd5\u7684\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u63a2\u7d22Python\u5185\u7f6e\u51fd\u6570<\/strong><\/p>\n<\/p>\n<p><p>\u901a\u8fc7<code>help()<\/code>\u51fd\u6570\uff0c\u4f60\u53ef\u4ee5\u63a2\u7d22Python\u63d0\u4f9b\u7684\u4e30\u5bcc\u5185\u7f6e\u51fd\u6570\u5e93\uff0c\u800c\u4e0d\u9700\u8981\u79bb\u5f00Python\u73af\u5883\u3002\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u5982\u679c\u4f60\u60f3\u4e86\u89e3<code>len()<\/code>\u51fd\u6570\u7684\u5177\u4f53\u4f5c\u7528\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">help(len)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u8fd4\u56de<code>len()<\/code>\u51fd\u6570\u7684\u8bf4\u660e\uff0c\u5305\u62ec\u5b83\u63a5\u53d7\u7684\u53c2\u6570\u548c\u8fd4\u56de\u7684\u7ed3\u679c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5e2e\u52a9\u7cfb\u7edf\u4e0e\u4ea4\u4e92\u6a21\u5f0f<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u4ea4\u4e92\u5f0fPython\u89e3\u91ca\u5668\u4e2d\uff0c\u8f93\u5165<code>help()<\/code>\u53ef\u4ee5\u542f\u52a8\u5e2e\u52a9\u4ea4\u4e92\u6a21\u5f0f\u3002\u5728\u6b64\u6a21\u5f0f\u4e0b\uff0c\u4f60\u53ef\u4ee5\u8f93\u5165\u7279\u5b9a\u7684\u547d\u4ee4\u6765\u83b7\u53d6\u66f4\u591a\u7684\u5e2e\u52a9\u4fe1\u606f\u3002\u4f8b\u5982\uff0c\u8f93\u5165<code>modules<\/code>\u53ef\u4ee5\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6a21\u5757\uff0c\u8f93\u5165<code>keywords<\/code>\u53ef\u4ee5\u67e5\u770b\u6240\u6709Python\u5173\u952e\u5b57\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u67e5\u770b\u5b98\u65b9\u6587\u6863<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Python\u5b98\u65b9\u7f51\u7ad9<\/strong><\/p>\n<\/p>\n<p><p>Python\u7684\u5b98\u65b9\u6587\u6863\u662f\u83b7\u53d6\u5e2e\u52a9\u7684\u6743\u5a01\u6765\u6e90\uff0c\u6db5\u76d6\u4e86Python\u8bed\u8a00\u7684\u6240\u6709\u65b9\u9762\uff0c\u5305\u62ec\u6807\u51c6\u5e93\u3001\u5185\u7f6e\u51fd\u6570\u3001\u8bed\u8a00\u8bed\u6cd5\u7b49\u3002\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/docs.python.org\/%EF%BC%89%E5%B9%B6%E6%9F%A5%E6%89%BE%E7%9B%B8%E5%85%B3%E4%B8%BB%E9%A2%98%EF%BC%8C%E5%8F%AF%E4%BB%A5%E8%8E%B7%E5%8F%96%E8%AF%A6%E7%BB%86%E8%80%8C%E5%87%86%E7%A1%AE%E7%9A%84%E4%BF%A1%E6%81%AF%E3%80%82\">https:\/\/docs.python.org\/\uff09\u5e76\u67e5\u627e\u76f8\u5173\u4e3b\u9898\uff0c\u53ef\u4ee5\u83b7\u53d6\u8be6\u7ec6\u800c\u51c6\u786e\u7684\u4fe1\u606f\u3002<\/a><\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6587\u6863\u7248\u672c\u9009\u62e9<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u5b98\u65b9\u6587\u6863\u7f51\u7ad9\u4e0a\uff0c\u4f60\u53ef\u4ee5\u9009\u62e9\u4e0d\u540c\u7248\u672c\u7684\u6587\u6863\uff0c\u4ee5\u786e\u4fdd\u4f60\u6b63\u5728\u4f7f\u7528\u7684Python\u7248\u672c\u5bf9\u5e94\u7684\u6587\u6863\u4fe1\u606f\u3002\u8fd9\u5bf9\u4e8e\u4f7f\u7528\u4e0d\u540cPython\u7248\u672c\u7684\u5f00\u53d1\u8005\u6765\u8bf4\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u4f7f\u7528IDE\u81ea\u5e26\u7684\u5e2e\u52a9\u529f\u80fd<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09<\/strong><\/p>\n<\/p>\n<p><p>\u8bb8\u591aIDE\uff08\u5982PyCharm\u3001Visual Studio Code\u3001Jupyter Notebook\u7b49\uff09\u63d0\u4f9b\u4e86\u5185\u7f6e\u7684\u5e2e\u52a9\u529f\u80fd\u3002\u5f53\u4f60\u5728\u7f16\u5199\u4ee3\u7801\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u5feb\u6377\u952e\u6216\u9f20\u6807\u60ac\u505c\u67e5\u770b\u51fd\u6570\u6216\u65b9\u6cd5\u7684\u6587\u6863\u5b57\u7b26\u4e32\u3002\u8fd9\u53ef\u4ee5\u5927\u5927\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4ee3\u7801\u81ea\u52a8\u8865\u5168<\/strong><\/p>\n<\/p>\n<p><p>IDE\u901a\u5e38\u8fd8\u63d0\u4f9b\u4ee3\u7801\u81ea\u52a8\u8865\u5168\u529f\u80fd\uff0c\u5728\u4f60\u8f93\u5165\u51fd\u6570\u540d\u6216\u5bf9\u8c61\u540d\u65f6\uff0c\u4f1a\u81ea\u52a8\u663e\u793a\u76f8\u5173\u6587\u6863\u4fe1\u606f\u548c\u53c2\u6570\u8bf4\u660e\uff0c\u5e2e\u52a9\u4f60\u66f4\u5feb\u901f\u5730\u7406\u89e3\u548c\u4f7f\u7528Python\u529f\u80fd\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u501f\u52a9\u5728\u7ebf\u8d44\u6e90<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u793e\u533a\u8bba\u575b\u548c\u95ee\u7b54\u7f51\u7ad9<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u7ebf\u793e\u533a\u5982Stack Overflow\u3001Reddit\u7684Python\u677f\u5757\uff0c\u662f\u83b7\u53d6\u5e2e\u52a9\u7684\u7edd\u4f73\u6e20\u9053\u3002\u5728\u8fd9\u4e9b\u5e73\u53f0\u4e0a\uff0c\u4f60\u53ef\u4ee5\u5411\u5176\u4ed6\u5f00\u53d1\u8005\u63d0\u95ee\uff0c\u6216\u67e5\u627e\u5df2\u6709\u7684\u76f8\u4f3c\u95ee\u9898\u548c\u7b54\u6848\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u535a\u5ba2\u548c\u6559\u7a0b<\/strong><\/p>\n<\/p>\n<p><p>\u4e92\u8054\u7f51\u4e0a\u6709\u8bb8\u591a\u9ad8\u8d28\u91cf\u7684\u535a\u5ba2\u548c\u6559\u7a0b\uff0c\u63d0\u4f9b\u6709\u5173Python\u7684\u6df1\u5165\u8bb2\u89e3\u548c\u5b9e\u4f8b\u3002\u8fd9\u4e9b\u8d44\u6e90\u53ef\u4ee5\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u7406\u89e3Python\u7684\u590d\u6742\u6982\u5ff5\u548c\u9ad8\u7ea7\u7528\u6cd5\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u5145\u5206\u5229\u7528\u8fd9\u4e9b\u5de5\u5177\u548c\u8d44\u6e90\uff0c\u4f60\u53ef\u4ee5\u5728Python\u7684\u5b66\u4e60\u548c\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u83b7\u5f97\u6709\u6548\u7684\u5e2e\u52a9\u3002\u8fd9\u4e0d\u4ec5\u80fd\u63d0\u9ad8\u4f60\u7684\u7f16\u7a0b\u6548\u7387\uff0c\u8fd8\u80fd\u52a0\u6df1\u4f60\u5bf9Python\u8bed\u8a00\u7684\u7406\u89e3\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u83b7\u53d6\u5e2e\u52a9\u6587\u6863\uff1f<\/strong><br \/>Python\u63d0\u4f9b\u4e86\u5185\u7f6e\u7684<code>help()<\/code>\u51fd\u6570\uff0c\u53ef\u4ee5\u8ba9\u7528\u6237\u5feb\u901f\u8bbf\u95ee\u6a21\u5757\u3001\u51fd\u6570\u3001\u7c7b\u548c\u65b9\u6cd5\u7684\u5e2e\u52a9\u6587\u6863\u3002\u53ea\u9700\u5728Python\u89e3\u91ca\u5668\u4e2d\u8f93\u5165<code>help(\u5bf9\u8c61)<\/code>\uff0c\u5176\u4e2d\u201c\u5bf9\u8c61\u201d\u53ef\u4ee5\u662f\u6a21\u5757\u540d\u3001\u51fd\u6570\u540d\u3001\u7c7b\u540d\u7b49\uff0c\u5373\u53ef\u663e\u793a\u76f8\u5173\u7684\u6587\u6863\u4fe1\u606f\u3002\u6b64\u5916\uff0c\u4f7f\u7528<code>help()<\/code>\u65f6\uff0c\u7528\u6237\u8fd8\u53ef\u4ee5\u901a\u8fc7<code>help(&#39;\u6a21\u5757\u540d&#39;)<\/code>\u6765\u83b7\u53d6\u7279\u5b9a\u6a21\u5757\u7684\u6574\u4f53\u5e2e\u52a9\u4fe1\u606f\u3002<\/p>\n<p><strong>\u5728Python\u4e2d\u6709\u6ca1\u6709\u56fe\u5f62\u5316\u7684\u5e2e\u52a9\u5de5\u5177\uff1f<\/strong><br \/>\u662f\u7684\uff0cPython\u6709\u591a\u79cd\u56fe\u5f62\u5316\u7684\u5e2e\u52a9\u5de5\u5177\uff0c\u4f8b\u5982IDLE\uff08\u96c6\u6210\u5f00\u53d1\u548c\u5b66\u4e60\u73af\u5883\uff09\u548cJupyter Notebook\u3002IDLE\u4e2d\u53ef\u4ee5\u901a\u8fc7\u83dc\u5355\u680f\u8bbf\u95ee\u201cHelp\u201d\u9009\u9879\uff0c\u67e5\u770b\u5404\u79cd\u6587\u6863\u548c\u6559\u7a0b\u3002\u800c\u5728Jupyter Notebook\u4e2d\uff0c\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u201c? \u201d\u6216\u201cShift + Tab\u201d\u547d\u4ee4\u6765\u83b7\u5f97\u7279\u5b9a\u51fd\u6570\u6216\u5bf9\u8c61\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u65b9\u4fbf\u8fdb\u884c\u4ea4\u4e92\u5f0f\u7f16\u7a0b\u3002<\/p>\n<p><strong>\u5982\u4f55\u67e5\u627e\u7b2c\u4e09\u65b9\u5e93\u7684\u5e2e\u52a9\u6587\u6863\uff1f<\/strong><br \/>\u5bf9\u4e8e\u7b2c\u4e09\u65b9\u5e93\uff0c\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u8bbf\u95ee\u5176\u5b98\u65b9\u7f51\u7ad9\u6216GitHub\u9875\u9762\u6765\u83b7\u53d6\u8be6\u7ec6\u7684\u6587\u6863\u548c\u4f7f\u7528\u793a\u4f8b\u3002\u8bb8\u591a\u7b2c\u4e09\u65b9\u5e93\u8fd8\u63d0\u4f9b\u4e86\u5728\u7ebf\u6587\u6863\uff0c\u4f8b\u5982Read the Docs\uff0c\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u641c\u7d22\u5e93\u7684\u540d\u79f0\u52a0\u4e0a\u201cdocumentation\u201d\u8fdb\u884c\u67e5\u627e\u3002\u6b64\u5916\uff0c\u4f7f\u7528<code>pip show \u5e93\u540d<\/code>\u547d\u4ee4\u4e5f\u80fd\u83b7\u5f97\u8be5\u5e93\u7684\u57fa\u672c\u4fe1\u606f\u53ca\u5176\u4e3b\u9875\u94fe\u63a5\uff0c\u4ece\u800c\u627e\u5230\u5e2e\u52a9\u6587\u6863\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\uff0c\u6709\u591a\u79cd\u65b9\u5f0f\u53ef\u4ee5\u83b7\u53d6\u5e2e\u52a9\u4fe1\u606f\u4ee5\u4fbf\u66f4\u597d\u5730\u7406\u89e3\u548c\u4f7f\u7528Python\u7684\u5404\u79cd\u529f\u80fd\u548c\u6a21\u5757\u3002\u4e3b\u8981\u7684\u65b9\u6cd5\u5305\u62ec\u4f7f [&hellip;]","protected":false},"author":3,"featured_media":1012674,"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\/1012659"}],"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=1012659"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1012659\/revisions"}],"predecessor-version":[{"id":1012678,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1012659\/revisions\/1012678"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1012674"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1012659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1012659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1012659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}