{"id":960264,"date":"2024-12-27T03:48:15","date_gmt":"2024-12-26T19:48:15","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/960264.html"},"modified":"2024-12-27T03:48:17","modified_gmt":"2024-12-26T19:48:17","slug":"%e5%a6%82%e4%bd%95%e5%af%b9python-%e9%87%8d%e5%91%bd%e5%90%8d","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/960264.html","title":{"rendered":"\u5982\u4f55\u5bf9python \u91cd\u547d\u540d"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25102838\/ef2ba48c-fd48-4eec-ba6f-3b6fc04a9417.webp\" alt=\"\u5982\u4f55\u5bf9python \u91cd\u547d\u540d\" \/><\/p>\n<p><p> <strong>\u5bf9Python\u8fdb\u884c\u91cd\u547d\u540d\u7684\u4e3b\u8981\u65b9\u6cd5\u6709\uff1a\u4fee\u6539\u6587\u4ef6\u540d\u3001\u4f7f\u7528\u522b\u540d\u5bfc\u5165\u3001\u521b\u5efa\u7b26\u53f7\u94fe\u63a5<\/strong>\u3002\u5176\u4e2d\uff0c<strong>\u4f7f\u7528\u522b\u540d\u5bfc\u5165<\/strong>\u662f\u6700\u5e38\u7528\u4e14\u7075\u6d3b\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u6709\u6548\u907f\u514d\u547d\u540d\u51b2\u7a81\uff0c\u5e76\u4e14\u5728\u4ee3\u7801\u4e2d\u6e05\u6670\u5730\u6307\u660e\u6a21\u5757\u7684\u7528\u9014\u3002<\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u522b\u540d\u5bfc\u5165\u662f\u4e00\u79cd\u5728\u4ee3\u7801\u4e2d\u91cd\u547d\u540dPython\u6a21\u5757\u6216\u5305\u7684\u7075\u6d3b\u65b9\u5f0f\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u6cd5\uff0c\u4f60\u53ef\u4ee5\u5728\u5bfc\u5165\u6a21\u5757\u65f6\u4e3a\u5176\u6307\u5b9a\u4e00\u4e2a\u65b0\u7684\u540d\u79f0\uff0c\u4ece\u800c\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528\u66f4\u6613\u8bfb\u6216\u66f4\u76f4\u89c2\u7684\u540d\u79f0\u6765\u5f15\u7528\u8be5\u6a21\u5757\u3002\u8fd9\u79cd\u65b9\u6cd5\u7279\u522b\u9002\u7528\u4e8e\u5904\u7406\u591a\u4e2a\u6a21\u5757\u4e4b\u95f4\u53ef\u80fd\u5b58\u5728\u7684\u547d\u540d\u51b2\u7a81\uff0c\u6216\u8005\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528\u8f83\u957f\u7684\u6a21\u5757\u540d\u79f0\u65f6\u7b80\u5316\u4e66\u5199\u3002\u4f8b\u5982\uff0c\u5f53\u4f7f\u7528<code>pandas<\/code>\u5e93\u65f6\uff0c\u901a\u5e38\u4f1a\u5c06\u5176\u5bfc\u5165\u4e3a<code>pd<\/code>\uff0c\u8fd9\u6837\u5728\u540e\u7eed\u4ee3\u7801\u4e2d\u8c03\u7528\u51fd\u6570\u65f6\u5c31\u80fd\u7b80\u5316\u4e66\u5199\uff0c\u5982<code>pd.DataFrame()<\/code>\u3002<\/p>\n<\/p>\n<hr>\n<p><h2>\u4e00\u3001\u4fee\u6539\u6587\u4ef6\u540d<\/h2>\n<\/p>\n<p><p>\u4fee\u6539\u6587\u4ef6\u540d\u662f\u6700\u76f4\u63a5\u7684\u65b9\u6cd5\u4e4b\u4e00\u3002\u901a\u8fc7\u76f4\u63a5\u66f4\u6539Python\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u53ef\u4ee5\u8fbe\u5230\u91cd\u547d\u540d\u7684\u6548\u679c\u3002\u7136\u800c\uff0c\u8fd9\u79cd\u65b9\u6cd5\u53ea\u9002\u7528\u4e8e\u66f4\u6539\u5355\u4e2a\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u4e0d\u9002\u7528\u4e8e\u66f4\u590d\u6742\u7684\u9879\u76ee\u7ed3\u6784\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u9700\u8981\u6ce8\u610f\u7684\u4e8b\u9879\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u786e\u4fdd\u6587\u4ef6\u540d\u552f\u4e00\u6027<\/strong>\uff1a\u4fee\u6539\u6587\u4ef6\u540d\u540e\uff0c\u9700\u8981\u786e\u4fdd\u65b0\u7684\u6587\u4ef6\u540d\u5728\u9879\u76ee\u4e2d\u662f\u552f\u4e00\u7684\uff0c\u4ee5\u907f\u514d\u547d\u540d\u51b2\u7a81\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u66f4\u65b0\u5bfc\u5165\u8bed\u53e5<\/strong>\uff1a\u5982\u679c\u5176\u4ed6\u6587\u4ef6\u4e2d\u6709\u5bf9\u8be5\u6587\u4ef6\u7684\u5f15\u7528\uff0c\u9700\u8981\u76f8\u5e94\u5730\u66f4\u65b0\u5bfc\u5165\u8bed\u53e5\uff0c\u4ee5\u786e\u4fdd\u7a0b\u5e8f\u7684\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528\u4e00\u81f4\u7684\u547d\u540d\u89c4\u8303<\/strong>\uff1a\u5728\u91cd\u547d\u540d\u6587\u4ef6\u65f6\uff0c\u5efa\u8bae\u9075\u5faa\u4e00\u81f4\u7684\u547d\u540d\u89c4\u8303\uff0c\u5982\u4f7f\u7528\u5c0f\u5199\u5b57\u6bcd\u548c\u4e0b\u5212\u7ebf\u5206\u9694\u5355\u8bcd\uff0c\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u793a\u4f8b<\/h3>\n<\/p>\n<p><p>\u5047\u8bbe\u6709\u4e00\u4e2a\u6587\u4ef6\u540d\u4e3a<code>old_name.py<\/code>\uff0c\u53ef\u4ee5\u76f4\u63a5\u5c06\u5176\u91cd\u547d\u540d\u4e3a<code>new_name.py<\/code>\u3002\u7136\u540e\u5728\u5176\u4ed6\u5f15\u7528\u8be5\u6587\u4ef6\u7684\u5730\u65b9\uff0c\u5c06\u5bfc\u5165\u8bed\u53e5\u4ece<code>import old_name<\/code>\u66f4\u6539\u4e3a<code>import new_name<\/code>\u3002<\/p>\n<\/p>\n<p><h2>\u4e8c\u3001\u4f7f\u7528\u522b\u540d\u5bfc\u5165<\/h2>\n<\/p>\n<p><p>\u4f7f\u7528\u522b\u540d\u5bfc\u5165\u662f\u4e00\u79cd\u7075\u6d3b\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5728\u4e0d\u66f4\u6539\u6587\u4ef6\u540d\u7684\u60c5\u51b5\u4e0b\u5bf9\u6a21\u5757\u8fdb\u884c\u91cd\u547d\u540d\u3002\u8fd9\u79cd\u65b9\u6cd5\u901a\u8fc7\u4e3a\u5bfc\u5165\u7684\u6a21\u5757\u6307\u5b9a\u4e00\u4e2a\u65b0\u7684\u540d\u79f0\u6765\u5b9e\u73b0\uff0c\u5728\u5904\u7406\u8f83\u957f\u6a21\u5757\u540d\u6216\u907f\u514d\u547d\u540d\u51b2\u7a81\u65f6\u975e\u5e38\u6709\u7528\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u9002\u7528\u6027\u5f3a<\/strong>\uff1a\u53ef\u4ee5\u5728\u4e0d\u4fee\u6539\u6587\u4ef6\u540d\u7684\u60c5\u51b5\u4e0b\u4f7f\u7528\uff0c\u9002\u7528\u4e8e\u4efb\u4f55Python\u6a21\u5757\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7b80\u5316\u4ee3\u7801<\/strong>\uff1a\u901a\u8fc7\u4f7f\u7528\u7b80\u77ed\u4e14\u5177\u6709\u63cf\u8ff0\u6027\u7684\u522b\u540d\uff0c\u53ef\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u7b80\u6d01\u6027\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u907f\u514d\u547d\u540d\u51b2\u7a81<\/strong>\uff1a\u5f53\u591a\u4e2a\u6a21\u5757\u5177\u6709\u76f8\u540c\u7684\u540d\u79f0\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u522b\u540d\u6765\u907f\u514d\u51b2\u7a81\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u793a\u4f8b<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<p>import numpy as np<\/p>\n<h2><strong>\u4f7f\u7528\u522b\u540d\u8c03\u7528\u6a21\u5757\u4e2d\u7684\u51fd\u6570<\/strong><\/h2>\n<p>df = pd.DataFrame({&#39;A&#39;: [1, 2, 3], &#39;B&#39;: [4, 5, 6]})<\/p>\n<p>array = np.array([1, 2, 3])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u4e09\u3001\u521b\u5efa\u7b26\u53f7\u94fe\u63a5<\/h2>\n<\/p>\n<p><p>\u7b26\u53f7\u94fe\u63a5\u662f\u4e00\u79cd\u5728\u6587\u4ef6\u7cfb\u7edf\u4e2d\u521b\u5efa\u522b\u540d\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5c06\u4e00\u4e2a\u6587\u4ef6\u6216\u76ee\u5f55\u94fe\u63a5\u5230\u53e6\u4e00\u4e2a\u4f4d\u7f6e\u3002\u901a\u8fc7\u521b\u5efa\u7b26\u53f7\u94fe\u63a5\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5bf9Python\u6587\u4ef6\u6216\u76ee\u5f55\u7684\u91cd\u547d\u540d\uff0c\u800c\u4e0d\u9700\u8981\u5b9e\u9645\u66f4\u6539\u5176\u540d\u79f0\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u7075\u6d3b\u6027\u9ad8<\/strong>\uff1a\u53ef\u4ee5\u5728\u4e0d\u66f4\u6539\u6587\u4ef6\u5b9e\u9645\u4f4d\u7f6e\u7684\u60c5\u51b5\u4e0b\uff0c\u521b\u5efa\u65b0\u7684\u8bbf\u95ee\u8def\u5f84\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u65b9\u4fbf\u7ba1\u7406<\/strong>\uff1a\u5c24\u5176\u9002\u7528\u4e8e\u590d\u6742\u7684\u9879\u76ee\u7ed3\u6784\uff0c\u53ef\u4ee5\u901a\u8fc7\u7b26\u53f7\u94fe\u63a5\u7ec4\u7ec7\u548c\u7ba1\u7406\u6587\u4ef6\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8de8\u5e73\u53f0\u6ce8\u610f\u4e8b\u9879<\/strong>\uff1a\u7b26\u53f7\u94fe\u63a5\u7684\u521b\u5efa\u548c\u7ba1\u7406\u5728\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u53ef\u80fd\u6709\u6240\u4e0d\u540c\uff0c\u9700\u8981\u786e\u4fdd\u5728\u76ee\u6807\u5e73\u53f0\u4e0a\u6b63\u786e\u914d\u7f6e\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u793a\u4f8b<\/h3>\n<\/p>\n<p><p>\u5728Linux\u6216MacOS\u4e0a\uff0c\u53ef\u4ee5\u4f7f\u7528<code>ln -s<\/code>\u547d\u4ee4\u521b\u5efa\u7b26\u53f7\u94fe\u63a5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">ln -s \/path\/to\/original_file.py \/path\/to\/symlink_name.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728Windows\u4e0a\uff0c\u53ef\u4ee5\u4f7f\u7528<code>mklink<\/code>\u547d\u4ee4\u521b\u5efa\u7b26\u53f7\u94fe\u63a5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">mklink symlink_name.py original_file.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u56db\u3001\u4f7f\u7528\u5305\u88c5\u6a21\u5757<\/h2>\n<\/p>\n<p><p>\u5305\u88c5\u6a21\u5757\u662f\u4e00\u79cd\u5c06\u591a\u4e2a\u6a21\u5757\u5c01\u88c5\u5728\u4e00\u8d77\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u901a\u8fc7\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Python\u6587\u4ef6\u6765\u5bfc\u5165\u548c\u91cd\u547d\u540d\u591a\u4e2a\u6a21\u5757\u3002\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u9700\u8981\u5bf9\u591a\u4e2a\u6a21\u5757\u8fdb\u884c\u91cd\u547d\u540d\u7684\u573a\u666f\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6a21\u5757\u5316\u7ba1\u7406<\/strong>\uff1a\u901a\u8fc7\u5c06\u591a\u4e2a\u6a21\u5757\u5c01\u88c5\u5728\u4e00\u4e2a\u5305\u88c5\u6a21\u5757\u4e2d\uff0c\u53ef\u4ee5\u66f4\u597d\u5730\u7ec4\u7ec7\u548c\u7ba1\u7406\u9879\u76ee\u7ed3\u6784\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7edf\u4e00\u547d\u540d<\/strong>\uff1a\u5728\u5305\u88c5\u6a21\u5757\u4e2d\u53ef\u4ee5\u7edf\u4e00\u5bf9\u5bfc\u5165\u7684\u6a21\u5757\u8fdb\u884c\u91cd\u547d\u540d\uff0c\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u4e00\u81f4\u6027\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6613\u4e8e\u6269\u5c55<\/strong>\uff1a\u968f\u7740\u9879\u76ee\u7684\u53d1\u5c55\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u5728\u5305\u88c5\u6a21\u5757\u4e2d\u6dfb\u52a0\u6216\u79fb\u9664\u6a21\u5757\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u793a\u4f8b<\/h3>\n<\/p>\n<p><p>\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>wrapper.py<\/code>\u7684\u5305\u88c5\u6a21\u5757\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import module_one as m1<\/p>\n<p>import module_two as m2<\/p>\n<h2><strong>\u5728\u5305\u88c5\u6a21\u5757\u4e2d\u4f7f\u7528\u91cd\u547d\u540d\u7684\u6a21\u5757<\/strong><\/h2>\n<p>def combined_function():<\/p>\n<p>    m1.function_one()<\/p>\n<p>    m2.function_two()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\u5728\u5176\u4ed6\u6587\u4ef6\u4e2d\u5bfc\u5165\u5305\u88c5\u6a21\u5757\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from wrapper import combined_function<\/p>\n<p>combined_function()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u4e94\u3001\u4f7f\u7528\u914d\u7f6e\u6587\u4ef6<\/h2>\n<\/p>\n<p><p>\u5728\u4e00\u4e9b\u5927\u578b\u9879\u76ee\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e\u6587\u4ef6\u6765\u5bf9\u6a21\u5757\u8fdb\u884c\u91cd\u547d\u540d\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5728\u9879\u76ee\u542f\u52a8\u65f6\u52a8\u6001\u52a0\u8f7d\u548c\u91cd\u547d\u540d\u6a21\u5757\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u52a8\u6001\u914d\u7f6e<\/strong>\uff1a\u53ef\u4ee5\u5728\u9879\u76ee\u8fd0\u884c\u65f6\u52a8\u6001\u4fee\u6539\u914d\u7f6e\uff0c\u800c\u4e0d\u9700\u8981\u66f4\u6539\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u96c6\u4e2d\u7ba1\u7406<\/strong>\uff1a\u901a\u8fc7\u914d\u7f6e\u6587\u4ef6\u96c6\u4e2d\u7ba1\u7406\u6a21\u5757\u7684\u91cd\u547d\u540d\uff0c\u63d0\u9ad8\u9879\u76ee\u7684\u7075\u6d3b\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9002\u7528\u4e8e\u5927\u578b\u9879\u76ee<\/strong>\uff1a\u5728\u9700\u8981\u5904\u7406\u5927\u91cf\u6a21\u5757\u7684\u590d\u6742\u9879\u76ee\u4e2d\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5c24\u4e3a\u6709\u6548\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u793a\u4f8b<\/h3>\n<\/p>\n<p><p>\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>config.py<\/code>\u7684\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">MODULE_RENAMES = {<\/p>\n<p>    &#39;old_module_name&#39;: &#39;new_module_name&#39;,<\/p>\n<p>    &#39;another_old_name&#39;: &#39;another_new_name&#39;<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u9879\u76ee\u4e2d\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\u5e76\u8fdb\u884c\u6a21\u5757\u91cd\u547d\u540d\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import importlib<\/p>\n<p>from config import MODULE_RENAMES<\/p>\n<p>for old_name, new_name in MODULE_RENAMES.items():<\/p>\n<p>    globals()[new_name] = importlib.import_module(old_name)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u51e0\u79cd\u65b9\u6cd5\uff0c\u53ef\u4ee5\u7075\u6d3b\u5730\u5bf9Python\u6a21\u5757\u8fdb\u884c\u91cd\u547d\u540d\uff0c\u4ee5\u6ee1\u8db3\u4e0d\u540c\u9879\u76ee\u7684\u9700\u6c42\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u53ef\u4ee5\u6839\u636e\u9879\u76ee\u7684\u5177\u4f53\u60c5\u51b5\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\uff0c\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u3001\u7ef4\u62a4\u6027\u548c\u7075\u6d3b\u6027\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u6709\u6548\u5730\u91cd\u547d\u540d\u6587\u4ef6\u6216\u6587\u4ef6\u5939\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>os<\/code>\u6a21\u5757\u4e2d\u7684<code>os.rename()<\/code>\u51fd\u6570\u6765\u91cd\u547d\u540d\u6587\u4ef6\u6216\u6587\u4ef6\u5939\u3002\u53ea\u9700\u63d0\u4f9b\u5f53\u524d\u540d\u79f0\u548c\u65b0\u540d\u79f0\u4f5c\u4e3a\u53c2\u6570\u3002\u4f8b\u5982\uff1a  <\/p>\n<pre><code class=\"language-python\">import os\n\n# \u91cd\u547d\u540d\u6587\u4ef6\nos.rename(&#39;\u65e7\u6587\u4ef6\u540d.txt&#39;, &#39;\u65b0\u6587\u4ef6\u540d.txt&#39;)\n\n# \u91cd\u547d\u540d\u6587\u4ef6\u5939\nos.rename(&#39;\u65e7\u6587\u4ef6\u5939\u540d&#39;, &#39;\u65b0\u6587\u4ef6\u5939\u540d&#39;)\n<\/code><\/pre>\n<p>\u786e\u4fdd\u5728\u6267\u884c\u91cd\u547d\u540d\u64cd\u4f5c\u4e4b\u524d\uff0c\u63d0\u4f9b\u7684\u8def\u5f84\u662f\u6b63\u786e\u7684\uff0c\u5e76\u4e14\u6587\u4ef6\u6216\u6587\u4ef6\u5939\u786e\u5b9e\u5b58\u5728\u3002<\/p>\n<p><strong>Python\u91cd\u547d\u540d\u53d8\u91cf\u540d\u7684\u6700\u4f73\u5b9e\u8df5\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53d8\u91cf\u540d\u7684\u91cd\u547d\u540d\u901a\u5e38\u901a\u8fc7\u7b80\u5355\u5730\u91cd\u65b0\u8d4b\u503c\u7ed9\u65b0\u7684\u53d8\u91cf\u540d\u6765\u5b9e\u73b0\u3002\u4e3a\u4e86\u786e\u4fdd\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u7ef4\u62a4\u6027\uff0c\u5efa\u8bae\u9075\u5faa\u4ee5\u4e0b\u6700\u4f73\u5b9e\u8df5\uff1a  <\/p>\n<ol>\n<li>\u4f7f\u7528\u6709\u610f\u4e49\u7684\u540d\u5b57\uff0c\u786e\u4fdd\u53d8\u91cf\u540d\u80fd\u591f\u6e05\u695a\u8868\u8fbe\u5176\u4f5c\u7528\u3002<\/li>\n<li>\u907f\u514d\u4f7f\u7528Python\u7684\u4fdd\u7559\u5b57\u4f5c\u4e3a\u53d8\u91cf\u540d\u3002<\/li>\n<li>\u907f\u514d\u5728\u91cd\u547d\u540d\u540e\u672a\u80fd\u66f4\u65b0\u6240\u6709\u5f15\u7528\u8be5\u53d8\u91cf\u7684\u5730\u65b9\uff0c\u4f7f\u7528IDE\u7684\u91cd\u6784\u529f\u80fd\u53ef\u4ee5\u5e2e\u52a9\u7b80\u5316\u8fd9\u4e00\u8fc7\u7a0b\u3002<\/li>\n<\/ol>\n<p><strong>\u91cd\u547d\u540dPython\u7c7b\u6216\u51fd\u6570\u65f6\u9700\u8981\u6ce8\u610f\u4ec0\u4e48\uff1f<\/strong><br \/>\u91cd\u547d\u540d\u7c7b\u6216\u51fd\u6570\u65f6\uff0c\u5e94\u8003\u8651\u4ee5\u4e0b\u51e0\u4e2a\u65b9\u9762\uff1a  <\/p>\n<ul>\n<li>\u786e\u4fdd\u65b0\u540d\u79f0\u9075\u5faaPython\u7684\u547d\u540d\u89c4\u8303\uff0c\u4f8b\u5982\u7c7b\u540d\u5e94\u4f7f\u7528\u9a7c\u5cf0\u5f0f\u547d\u540d\u6cd5\uff08\u5982<code>MyClass<\/code>\uff09\uff0c\u800c\u51fd\u6570\u540d\u4f7f\u7528\u5c0f\u5199\u5b57\u6bcd\u52a0\u4e0b\u5212\u7ebf\uff08\u5982<code>my_function<\/code>\uff09\u3002<\/li>\n<li>\u66f4\u65b0\u6240\u6709\u5f15\u7528\u8be5\u7c7b\u6216\u51fd\u6570\u7684\u5730\u65b9\uff0c\u9632\u6b62\u51fa\u73b0\u672a\u5b9a\u4e49\u9519\u8bef\u3002<\/li>\n<li>\u5728\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u4e2d\uff0c\u8bb0\u5f55\u4e0b\u8fd9\u4e9b\u66f4\u6539\uff0c\u4fbf\u4e8e\u672a\u6765\u7684<a href=\"https:\/\/docs.pingcode.com\/code-review\" target=\"_blank\">\u4ee3\u7801\u5ba1\u67e5<\/a>\u548c\u7ef4\u62a4\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"\u5bf9Python\u8fdb\u884c\u91cd\u547d\u540d\u7684\u4e3b\u8981\u65b9\u6cd5\u6709\uff1a\u4fee\u6539\u6587\u4ef6\u540d\u3001\u4f7f\u7528\u522b\u540d\u5bfc\u5165\u3001\u521b\u5efa\u7b26\u53f7\u94fe\u63a5\u3002\u5176\u4e2d\uff0c\u4f7f\u7528\u522b\u540d\u5bfc\u5165\u662f\u6700\u5e38\u7528\u4e14\u7075\u6d3b [&hellip;]","protected":false},"author":3,"featured_media":960271,"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\/960264"}],"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=960264"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/960264\/revisions"}],"predecessor-version":[{"id":960272,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/960264\/revisions\/960272"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/960271"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=960264"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=960264"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=960264"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}