{"id":1091539,"date":"2025-01-08T14:12:39","date_gmt":"2025-01-08T06:12:39","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1091539.html"},"modified":"2025-01-08T14:12:42","modified_gmt":"2025-01-08T06:12:42","slug":"python%e5%a6%82%e4%bd%95%e5%8f%aa%e5%af%bc%e5%85%a5%e4%b8%80%e4%b8%aa%e5%87%bd%e6%95%b0-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1091539.html","title":{"rendered":"python\u5982\u4f55\u53ea\u5bfc\u5165\u4e00\u4e2a\u51fd\u6570"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24203701\/352e449b-c9a1-45b5-9e53-56e1fa8ae2c2.webp\" alt=\"python\u5982\u4f55\u53ea\u5bfc\u5165\u4e00\u4e2a\u51fd\u6570\" \/><\/p>\n<p><p> <strong>\u5728Python\u4e2d\uff0c\u53ea\u5bfc\u5165\u4e00\u4e2a\u51fd\u6570\u7684\u65b9\u6cd5\u662f\u4f7f\u7528<code>from<\/code>\u5173\u952e\u5b57\u3002<\/strong> \u4f8b\u5982\uff0c\u5982\u679c\u4f60\u53ea\u60f3\u4ece\u67d0\u4e2a\u6a21\u5757\u4e2d\u5bfc\u5165\u4e00\u4e2a\u7279\u5b9a\u7684\u51fd\u6570\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\uff1a<code>from module_name import function_name<\/code>\u3002\u8fd9\u79cd\u65b9\u6cd5\u53ef\u4ee5\u5e2e\u52a9\u51cf\u5c11\u5185\u5b58\u7684\u4f7f\u7528\u3001\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u51cf\u5c11\u547d\u540d\u51b2\u7a81\u3002\u4e0b\u9762\u662f\u8be6\u7ec6\u7684\u89e3\u91ca\u548c\u793a\u4f8b\u3002<\/p>\n<\/p>\n<hr>\n<p><h3>\u4e00\u3001<code>from<\/code>\u5173\u952e\u5b57\u7684\u4f7f\u7528\u65b9\u6cd5<\/h3>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u6a21\u5757\u662f\u4e00\u4e2a\u5305\u542bPython\u4ee3\u7801\u7684\u6587\u4ef6\u3002\u6a21\u5757\u53ef\u4ee5\u5b9a\u4e49\u51fd\u6570\u3001\u7c7b\u548c\u53d8\u91cf\uff0c\u4e5f\u53ef\u4ee5\u5305\u542b\u53ef\u6267\u884c\u7684\u4ee3\u7801\u3002\u4e3a\u4e86\u5bfc\u5165\u6a21\u5757\u4e2d\u7684\u7279\u5b9a\u51fd\u6570\uff0c\u53ef\u4ee5\u4f7f\u7528<code>from ... import ...<\/code>\u8bed\u53e5\u3002\u6bd4\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from math import sqrt<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u884c\u4ee3\u7801\u4ece<code>math<\/code>\u6a21\u5757\u4e2d\u53ea\u5bfc\u5165\u4e86<code>sqrt<\/code>\u51fd\u6570\uff0c\u8fd9\u6837\u4f60\u5c31\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528<code>sqrt()<\/code>\u51fd\u6570\uff0c\u800c\u4e0d\u9700\u8981\u5f15\u7528\u6574\u4e2a\u6a21\u5757\u3002<\/p>\n<\/p>\n<hr>\n<p><h3>\u4e8c\u3001\u51cf\u5c11\u5185\u5b58\u4f7f\u7528<\/h3>\n<\/p>\n<p><p>\u5bfc\u5165\u6574\u4e2a\u6a21\u5757\u53ef\u80fd\u4f1a\u5360\u7528\u66f4\u591a\u7684\u5185\u5b58\uff0c\u5c24\u5176\u662f\u5f53\u6a21\u5757\u975e\u5e38\u5e9e\u5927\u65f6\u3002\u901a\u8fc7\u53ea\u5bfc\u5165\u9700\u8981\u7684\u51fd\u6570\uff0c\u53ef\u4ee5\u663e\u8457\u51cf\u5c11\u5185\u5b58\u7684\u4f7f\u7528\u3002\u8fd9\u5bf9\u4e8e\u8d44\u6e90\u6709\u9650\u7684\u73af\u5883\u5c24\u4e3a\u91cd\u8981\u3002<\/p>\n<\/p>\n<p><p>\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from pandas import read_csv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u53ea\u9700\u8981<code>pandas<\/code>\u6a21\u5757\u4e2d\u7684<code>read_csv<\/code>\u51fd\u6570\uff0c\u4f7f\u7528\u8fd9\u79cd\u65b9\u5f0f\u5bfc\u5165\u53ef\u4ee5\u907f\u514d\u52a0\u8f7d\u6574\u4e2a<code>pandas<\/code>\u5e93\uff0c\u4ece\u800c\u8282\u7701\u5185\u5b58\u3002<\/p>\n<\/p>\n<hr>\n<p><h3>\u4e09\u3001\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027<\/h3>\n<\/p>\n<p><p>\u5bfc\u5165\u5355\u4e2a\u51fd\u6570\u53ef\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002\u5f53\u5176\u4ed6\u5f00\u53d1\u8005\u9605\u8bfb\u4f60\u7684\u4ee3\u7801\u65f6\uff0c\u4ed6\u4eec\u53ef\u4ee5\u7acb\u5373\u77e5\u9053\u4f60\u5728\u4f7f\u7528\u54ea\u4e2a\u6a21\u5757\u7684\u54ea\u4e2a\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><p>\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from datetime import datetime<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u79cd\u5bfc\u5165\u65b9\u5f0f\u4f7f\u5f97\u4ee3\u7801\u66f4\u52a0\u7b80\u6d01\u660e\u4e86\uff0c\u5176\u4ed6\u5f00\u53d1\u8005\u53ef\u4ee5\u7acb\u5373\u660e\u767d\u4f60\u5728\u4f7f\u7528<code>datetime<\/code>\u6a21\u5757\u4e2d\u7684<code>datetime<\/code>\u7c7b\u3002<\/p>\n<\/p>\n<hr>\n<p><h3>\u56db\u3001\u51cf\u5c11\u547d\u540d\u51b2\u7a81<\/h3>\n<\/p>\n<p><p>\u5728\u5927\u578b\u9879\u76ee\u4e2d\uff0c\u547d\u540d\u51b2\u7a81\u662f\u4e00\u4e2a\u5e38\u89c1\u7684\u95ee\u9898\u3002\u901a\u8fc7\u53ea\u5bfc\u5165\u9700\u8981\u7684\u51fd\u6570\uff0c\u53ef\u4ee5\u907f\u514d\u4e0e\u5176\u4ed6\u6a21\u5757\u4e2d\u7684\u51fd\u6570\u53d1\u751f\u547d\u540d\u51b2\u7a81\u3002<\/p>\n<\/p>\n<p><p>\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from os.path import join<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u79cd\u5bfc\u5165\u65b9\u5f0f\u53ef\u4ee5\u907f\u514d\u4e0e\u5176\u4ed6\u6a21\u5757\u4e2d\u7684<code>join<\/code>\u51fd\u6570\uff08\u5982\u679c\u6709\u7684\u8bdd\uff09\u53d1\u751f\u51b2\u7a81\u3002<\/p>\n<\/p>\n<hr>\n<p><h3>\u4e94\u3001\u793a\u4f8b\u4ee3\u7801\u53ca\u5e94\u7528\u573a\u666f<\/h3>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\uff0c\u5c55\u793a\u5982\u4f55\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\u53ea\u5bfc\u5165\u4e00\u4e2a\u51fd\u6570\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u793a\u4f8b\uff1a\u53ea\u5bfc\u5165math\u6a21\u5757\u4e2d\u7684sqrt\u51fd\u6570<\/p>\n<p>from math import sqrt<\/p>\n<h2><strong>\u8ba1\u7b97\u5e73\u65b9\u6839<\/strong><\/h2>\n<p>number = 9<\/p>\n<p>result = sqrt(number)<\/p>\n<p>print(f&quot;The square root of {number} is {result}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u53ea\u5bfc\u5165\u4e86<code>math<\/code>\u6a21\u5757\u4e2d\u7684<code>sqrt<\/code>\u51fd\u6570\uff0c\u7136\u540e\u4f7f\u7528\u5b83\u6765\u8ba1\u7b97\u4e00\u4e2a\u6570\u5b57\u7684\u5e73\u65b9\u6839\u3002\u8fd9\u4e0d\u4ec5\u4f7f\u4ee3\u7801\u66f4\u7b80\u6d01\uff0c\u800c\u4e14\u63d0\u9ad8\u4e86\u6267\u884c\u6548\u7387\u3002<\/p>\n<\/p>\n<hr>\n<p><h3>\u516d\u3001\u907f\u514d\u5e38\u89c1\u9519\u8bef<\/h3>\n<\/p>\n<ol>\n<li><strong>\u5bfc\u5165\u4e0d\u5b58\u5728\u7684\u51fd\u6570<\/strong>\uff1a\u786e\u4fdd\u4f60\u5bfc\u5165\u7684\u51fd\u6570\u5728\u76f8\u5e94\u7684\u6a21\u5757\u4e2d\u5b9e\u9645\u5b58\u5728\uff0c\u5426\u5219\u4f1a\u5f15\u53d1<code>ImportError<\/code>\u3002<\/li>\n<li><strong>\u547d\u540d\u51b2\u7a81<\/strong>\uff1a\u5982\u679c\u4f60\u5bfc\u5165\u7684\u51fd\u6570\u540d\u4e0e\u5df2\u6709\u7684\u53d8\u91cf\u540d\u6216\u51fd\u6570\u540d\u51b2\u7a81\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u610f\u60f3\u4e0d\u5230\u7684\u884c\u4e3a\u3002<\/li>\n<li><strong>\u5ffd\u7565\u547d\u540d\u7a7a\u95f4<\/strong>\uff1a\u5728\u5927\u578b\u9879\u76ee\u4e2d\uff0c\u76f4\u63a5\u5bfc\u5165\u51fd\u6570\u53ef\u80fd\u4f1a\u5bfc\u81f4\u547d\u540d\u7a7a\u95f4\u6df7\u4e71\uff0c\u56e0\u6b64\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u5bfc\u5165\u6574\u4e2a\u6a21\u5757\u53ef\u80fd\u662f\u66f4\u597d\u7684\u9009\u62e9\u3002<\/li>\n<\/ol>\n<hr>\n<p><h3>\u4e03\u3001\u5b9e\u9645\u9879\u76ee\u4e2d\u7684\u6700\u4f73\u5b9e\u8df5<\/h3>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\uff0c\u5408\u7406\u4f7f\u7528\u5bfc\u5165\u8bed\u53e5\u53ef\u4ee5\u663e\u8457\u63d0\u9ad8\u4ee3\u7801\u7684\u8d28\u91cf\u548c\u53ef\u7ef4\u62a4\u6027\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u6700\u4f73\u5b9e\u8df5\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u660e\u786e\u5bfc\u5165<\/strong>\uff1a\u5c3d\u91cf\u660e\u786e\u5bfc\u5165\u9700\u8981\u7684\u51fd\u6570\u6216\u7c7b\uff0c\u800c\u4e0d\u662f\u4f7f\u7528\u901a\u914d\u7b26<code>*<\/code>\uff0c\u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u547d\u540d\u51b2\u7a81\u5e76\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u3002<\/li>\n<li><strong>\u5206\u7ec4\u5bfc\u5165<\/strong>\uff1a\u5c06\u5bfc\u5165\u8bed\u53e5\u5206\u7ec4\u653e\u7f6e\u5728\u6587\u4ef6\u7684\u9876\u90e8\uff0c\u4f7f\u5f97\u4ee3\u7801\u7ed3\u6784\u66f4\u6e05\u6670\u3002<\/li>\n<li><strong>\u907f\u514d\u5faa\u73af\u5bfc\u5165<\/strong>\uff1a\u5728\u8bbe\u8ba1\u6a21\u5757\u65f6\uff0c\u907f\u514d\u6a21\u5757\u4e4b\u95f4\u7684\u5faa\u73af\u4f9d\u8d56\uff0c\u8fd9\u53ef\u4ee5\u901a\u8fc7\u5408\u7406\u7684\u6a21\u5757\u62c6\u5206\u548c\u8bbe\u8ba1\u6765\u5b9e\u73b0\u3002<\/li>\n<\/ol>\n<hr>\n<p><h3>\u516b\u3001\u6df1\u5165\u7406\u89e3\u6a21\u5757\u5bfc\u5165\u673a\u5236<\/h3>\n<\/p>\n<p><p>Python\u7684\u6a21\u5757\u5bfc\u5165\u673a\u5236\u662f\u901a\u8fc7\u67e5\u627e\u548c\u52a0\u8f7d\u6a21\u5757\u6587\u4ef6\u6765\u5b9e\u73b0\u7684\u3002\u4e86\u89e3\u8fd9\u4e00\u673a\u5236\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u66f4\u597d\u5730\u8bbe\u8ba1\u548c\u4f18\u5316\u4ee3\u7801\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5173\u952e\u70b9\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u6a21\u5757\u641c\u7d22\u8def\u5f84<\/strong>\uff1aPython\u4f1a\u6309\u7167\u4e00\u5b9a\u7684\u987a\u5e8f\u641c\u7d22\u6a21\u5757\uff0c\u901a\u5e38\u5305\u62ec\u5f53\u524d\u76ee\u5f55\u3001\u6807\u51c6\u5e93\u76ee\u5f55\u548c\u7b2c\u4e09\u65b9\u5e93\u76ee\u5f55\u3002<\/li>\n<li><strong>\u7f13\u5b58\u673a\u5236<\/strong>\uff1aPython\u4f1a\u7f13\u5b58\u5df2\u5bfc\u5165\u7684\u6a21\u5757\uff0c\u4ee5\u63d0\u9ad8\u540e\u7eed\u5bfc\u5165\u7684\u6548\u7387\u3002<\/li>\n<li><strong>\u5305\u548c\u5b50\u5305<\/strong>\uff1a\u6a21\u5757\u53ef\u4ee5\u7ec4\u7ec7\u6210\u5305\u548c\u5b50\u5305\uff0c\u901a\u8fc7\u76ee\u5f55\u7ed3\u6784\u548c\u7279\u6b8a\u7684<code>__init__.py<\/code>\u6587\u4ef6\u6765\u5b9e\u73b0\u3002<\/li>\n<\/ol>\n<hr>\n<p><h3>\u4e5d\u3001\u6027\u80fd\u4f18\u5316<\/h3>\n<\/p>\n<p><p>\u5728\u5927\u578b\u9879\u76ee\u4e2d\uff0c\u5bfc\u5165\u64cd\u4f5c\u7684\u6027\u80fd\u53ef\u80fd\u4f1a\u5f71\u54cd\u6574\u4f53\u6027\u80fd\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u4f18\u5316\u5efa\u8bae\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u5ef6\u8fdf\u5bfc\u5165<\/strong>\uff1a\u5728\u51fd\u6570\u6216\u65b9\u6cd5\u5185\u90e8\u8fdb\u884c\u5bfc\u5165\u64cd\u4f5c\uff0c\u907f\u514d\u5728\u6a21\u5757\u52a0\u8f7d\u65f6\u5bfc\u5165\u4e0d\u5fc5\u8981\u7684\u6a21\u5757\u3002<\/li>\n<li><strong>\u51cf\u5c11\u5bfc\u5165\u6b21\u6570<\/strong>\uff1a\u5c3d\u91cf\u907f\u514d\u91cd\u590d\u5bfc\u5165\u76f8\u540c\u7684\u6a21\u5757\uff0c\u53ef\u4ee5\u901a\u8fc7\u5408\u7406\u7684\u6a21\u5757\u8bbe\u8ba1\u548c\u4ee3\u7801\u91cd\u7528\u6765\u5b9e\u73b0\u3002<\/li>\n<li><strong>\u4f7f\u7528\u672c\u5730\u5bfc\u5165<\/strong>\uff1a\u5728\u9700\u8981\u65f6\u624d\u5bfc\u5165\u6a21\u5757\uff0c\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u5168\u5c40\u5bfc\u5165\u3002<\/li>\n<\/ol>\n<hr>\n<p><h3>\u5341\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u901a\u8fc7\u53ea\u5bfc\u5165\u4e00\u4e2a\u51fd\u6570\uff0c\u53ef\u4ee5\u663e\u8457\u63d0\u9ad8\u4ee3\u7801\u7684\u6548\u7387\u3001\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\uff0c\u5408\u7406\u4f7f\u7528\u5bfc\u5165\u8bed\u53e5\u548c\u6700\u4f73\u5b9e\u8df5\uff0c\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u7f16\u5199\u51fa\u9ad8\u8d28\u91cf\u7684Python\u4ee3\u7801\u3002<strong>\u51cf\u5c11\u5185\u5b58\u4f7f\u7528\u3001\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u3001\u51cf\u5c11\u547d\u540d\u51b2\u7a81<\/strong>\u662f\u8fd9\u79cd\u65b9\u6cd5\u7684\u4e09\u5927\u4e3b\u8981\u4f18\u52bf\u3002\u7406\u89e3\u548c\u638c\u63e1\u8fd9\u4e9b\u6280\u5de7\uff0c\u5bf9\u4e8e\u4efb\u4f55\u5e0c\u671b\u6210\u4e3a\u9ad8\u7ea7Python\u5f00\u53d1\u8005\u7684\u4eba\u6765\u8bf4\uff0c\u90fd\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u53ea\u5bfc\u5165\u7279\u5b9a\u7684\u51fd\u6570\u800c\u4e0d\u5bfc\u5165\u6574\u4e2a\u6a21\u5757\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>from<\/code>\u8bed\u53e5\u6765\u53ea\u5bfc\u5165\u7279\u5b9a\u7684\u51fd\u6570\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u6709\u4e00\u4e2a\u6a21\u5757\u540d\u4e3a<code>mymodule<\/code>\uff0c\u5e76\u4e14\u60f3\u8981\u5bfc\u5165\u5176\u4e2d\u7684\u51fd\u6570<code>myfunction<\/code>\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u4ee3\u7801\uff1a  <\/p>\n<pre><code class=\"language-python\">from mymodule import myfunction\n<\/code><\/pre>\n<p>\u8fd9\u6837\uff0c\u4f60\u5c31\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528<code>myfunction<\/code>\u800c\u65e0\u9700\u5f15\u7528\u6a21\u5757\u540d\u3002<\/p>\n<p><strong>\u5982\u679c\u6211\u9700\u8981\u5bfc\u5165\u591a\u4e2a\u51fd\u6570\uff0c\u5e94\u8be5\u600e\u4e48\u505a\uff1f<\/strong><br \/>\u5982\u679c\u4f60\u5e0c\u671b\u540c\u65f6\u5bfc\u5165\u591a\u4e2a\u51fd\u6570\uff0c\u53ef\u4ee5\u5728\u5bfc\u5165\u8bed\u53e5\u4e2d\u7528\u9017\u53f7\u5206\u9694\u5b83\u4eec\u3002\u4f8b\u5982\uff1a  <\/p>\n<pre><code class=\"language-python\">from mymodule import function1, function2, function3\n<\/code><\/pre>\n<p>\u8fd9\u6837\uff0c\u4f60\u53ef\u4ee5\u5728\u4ee3\u7801\u4e2d\u76f4\u63a5\u4f7f\u7528\u8fd9\u4e09\u4e2a\u51fd\u6570\uff0c\u800c\u65e0\u9700\u4f7f\u7528\u6a21\u5757\u540d\u3002<\/p>\n<p><strong>\u5728\u5bfc\u5165\u51fd\u6570\u65f6\uff0c\u5982\u4f55\u907f\u514d\u540d\u79f0\u51b2\u7a81\uff1f<\/strong><br \/>\u5982\u679c\u4f60\u5bfc\u5165\u7684\u51fd\u6570\u4e0e\u5f53\u524d\u4ee3\u7801\u4e2d\u7684\u5176\u4ed6\u51fd\u6570\u6216\u53d8\u91cf\u540c\u540d\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u540d\u79f0\u51b2\u7a81\u3002\u4e3a\u4e86\u907f\u514d\u8fd9\u79cd\u60c5\u51b5\uff0c\u53ef\u4ee5\u4f7f\u7528<code>as<\/code>\u5173\u952e\u5b57\u4e3a\u5bfc\u5165\u7684\u51fd\u6570\u6307\u5b9a\u4e00\u4e2a\u522b\u540d\u3002\u4f8b\u5982\uff1a  <\/p>\n<pre><code class=\"language-python\">from mymodule import myfunction as mf\n<\/code><\/pre>\n<p>\u8fd9\u6837\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528<code>mf()<\/code>\u6765\u8c03\u7528<code>myfunction<\/code>\uff0c\u4ece\u800c\u907f\u514d\u4e0e\u5176\u4ed6\u540c\u540d\u51fd\u6570\u7684\u51b2\u7a81\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\uff0c\u53ea\u5bfc\u5165\u4e00\u4e2a\u51fd\u6570\u7684\u65b9\u6cd5\u662f\u4f7f\u7528from\u5173\u952e\u5b57\u3002 \u4f8b\u5982\uff0c\u5982\u679c\u4f60\u53ea\u60f3\u4ece\u67d0\u4e2a\u6a21\u5757\u4e2d\u5bfc\u5165\u4e00\u4e2a\u7279\u5b9a\u7684\u51fd\u6570\uff0c [&hellip;]","protected":false},"author":3,"featured_media":1091546,"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\/1091539"}],"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=1091539"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1091539\/revisions"}],"predecessor-version":[{"id":1091550,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1091539\/revisions\/1091550"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1091546"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1091539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1091539"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1091539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}