{"id":1187066,"date":"2025-01-15T20:00:40","date_gmt":"2025-01-15T12:00:40","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1187066.html"},"modified":"2025-01-15T20:00:44","modified_gmt":"2025-01-15T12:00:44","slug":"python%e5%a6%82%e4%bd%95%e7%bc%96%e5%86%99%e8%ae%be%e8%ae%a1%e8%ae%a1%e7%ae%97%e7%a8%8b%e5%ba%8f","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1187066.html","title":{"rendered":"python\u5982\u4f55\u7f16\u5199\u8bbe\u8ba1\u8ba1\u7b97\u7a0b\u5e8f"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25135700\/4565d606-a9a6-43aa-a665-7735f5b05cd0.webp\" alt=\"python\u5982\u4f55\u7f16\u5199\u8bbe\u8ba1\u8ba1\u7b97\u7a0b\u5e8f\" \/><\/p>\n<p><p> <strong>Python\u7f16\u5199\u8bbe\u8ba1\u8ba1\u7b97\u7a0b\u5e8f\u65f6\uff0c\u9700\u8003\u8651\u7a0b\u5e8f\u7684\u7ed3\u6784\u5316\u8bbe\u8ba1\u3001\u7b97\u6cd5\u7684\u9009\u62e9\u4e0e\u4f18\u5316\u3001\u6a21\u5757\u5316\u7f16\u7a0b\u3001\u9519\u8bef\u5904\u7406\u548c\u7528\u6237\u4ea4\u4e92\u7b49\u65b9\u9762\u3002<\/strong>\u5177\u4f53\u6765\u8bf4\uff0c\u53ef\u4ee5\u4ece\u4ee5\u4e0b\u51e0\u4e2a\u65b9\u9762\u8fdb\u884c\u8be6\u7ec6\u63cf\u8ff0\uff1a<strong>\u7ed3\u6784\u5316\u8bbe\u8ba1\u3001\u6a21\u5757\u5316\u7f16\u7a0b\u3001\u7b97\u6cd5\u4f18\u5316\u3001\u9519\u8bef\u5904\u7406\u548c\u7528\u6237\u4ea4\u4e92<\/strong>\u3002\u5176\u4e2d\uff0c<strong>\u6a21\u5757\u5316\u7f16\u7a0b<\/strong>\u662f\u6700\u4e3a\u91cd\u8981\u7684\u4e00\u70b9\uff0c\u56e0\u4e3a\u5b83\u80fd\u591f\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u7ef4\u62a4\u6027\u548c\u53ef\u91cd\u7528\u6027\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u7ed3\u6784\u5316\u8bbe\u8ba1<\/h3>\n<\/p>\n<p><p>\u7ed3\u6784\u5316\u8bbe\u8ba1\u662f\u7f16\u5199\u8bbe\u8ba1\u8ba1\u7b97\u7a0b\u5e8f\u7684\u57fa\u7840\u3002\u7ed3\u6784\u5316\u8bbe\u8ba1\u7684\u57fa\u672c\u601d\u60f3\u662f\u5c06\u95ee\u9898\u5206\u89e3\u6210\u82e5\u5e72\u4e2a\u5b50\u95ee\u9898\uff0c\u7136\u540e\u9010\u4e2a\u89e3\u51b3\u5b50\u95ee\u9898\uff0c\u4ece\u800c\u89e3\u51b3\u6574\u4e2a\u95ee\u9898\u3002Python\u4f5c\u4e3a\u4e00\u79cd\u9ad8\u7ea7\u7f16\u7a0b\u8bed\u8a00\uff0c\u652f\u6301\u591a\u79cd\u7f16\u7a0b\u8303\u5f0f\uff0c\u5305\u62ec\u8fc7\u7a0b\u5316\u7f16\u7a0b\u3001\u9762\u5411\u5bf9\u8c61\u7f16\u7a0b\u548c\u51fd\u6570\u5f0f\u7f16\u7a0b\u3002\u5728\u7f16\u5199\u8bbe\u8ba1\u8ba1\u7b97\u7a0b\u5e8f\u65f6\uff0c\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u95ee\u9898\u9009\u62e9\u5408\u9002\u7684\u7f16\u7a0b\u8303\u5f0f\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u5206\u89e3\u95ee\u9898<\/h4>\n<\/p>\n<p><p>\u5728\u7f16\u5199\u8bbe\u8ba1\u8ba1\u7b97\u7a0b\u5e8f\u65f6\uff0c\u9996\u5148\u8981\u5bf9\u95ee\u9898\u8fdb\u884c\u5206\u89e3\u3002\u5c06\u590d\u6742\u7684\u95ee\u9898\u5206\u89e3\u6210\u82e5\u5e72\u4e2a\u7b80\u5355\u7684\u5b50\u95ee\u9898\uff0c\u7136\u540e\u9010\u4e2a\u89e3\u51b3\u6bcf\u4e2a\u5b50\u95ee\u9898\u3002\u53ef\u4ee5\u4f7f\u7528\u6d41\u7a0b\u56fe\u3001\u4f2a\u4ee3\u7801\u7b49\u5de5\u5177\u6765\u5e2e\u52a9\u5206\u89e3\u95ee\u9898\u548c\u8bbe\u8ba1\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<p><h4>2\u3001\u8bbe\u8ba1\u6570\u636e\u7ed3\u6784<\/h4>\n<\/p>\n<p><p>\u6570\u636e\u7ed3\u6784\u662f\u7a0b\u5e8f\u8bbe\u8ba1\u7684\u57fa\u7840\u3002\u5728\u8bbe\u8ba1\u8ba1\u7b97\u7a0b\u5e8f\u65f6\uff0c\u9700\u8981\u6839\u636e\u95ee\u9898\u7684\u5177\u4f53\u8981\u6c42\u9009\u62e9\u5408\u9002\u7684\u6570\u636e\u7ed3\u6784\u3002\u5e38\u7528\u7684\u6570\u636e\u7ed3\u6784\u5305\u62ec\u6570\u7ec4\u3001\u94fe\u8868\u3001\u6808\u3001\u961f\u5217\u3001\u6811\u3001\u56fe\u7b49\u3002\u9009\u62e9\u5408\u9002\u7684\u6570\u636e\u7ed3\u6784\u53ef\u4ee5\u63d0\u9ad8\u7a0b\u5e8f\u7684\u6548\u7387\u548c\u53ef\u8bfb\u6027\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u6a21\u5757\u5316\u7f16\u7a0b<\/h3>\n<\/p>\n<p><p>\u6a21\u5757\u5316\u7f16\u7a0b\u662f\u63d0\u9ad8\u4ee3\u7801\u53ef\u7ef4\u62a4\u6027\u548c\u53ef\u91cd\u7528\u6027\u7684\u6709\u6548\u65b9\u6cd5\u3002\u901a\u8fc7\u5c06\u7a0b\u5e8f\u5212\u5206\u4e3a\u82e5\u5e72\u4e2a\u6a21\u5757\uff0c\u6bcf\u4e2a\u6a21\u5757\u5b9e\u73b0\u7279\u5b9a\u7684\u529f\u80fd\uff0c\u53ef\u4ee5\u4f7f\u7a0b\u5e8f\u7ed3\u6784\u66f4\u52a0\u6e05\u6670\uff0c\u4fbf\u4e8e\u6d4b\u8bd5\u548c\u7ef4\u62a4\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u5b9a\u4e49\u6a21\u5757<\/h4>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u51fd\u6570\u3001\u7c7b\u548c\u6a21\u5757\u6765\u5b9e\u73b0\u6a21\u5757\u5316\u7f16\u7a0b\u3002\u51fd\u6570\u662f\u6a21\u5757\u5316\u7f16\u7a0b\u7684\u57fa\u672c\u5355\u5143\uff0c\u901a\u8fc7\u5c06\u91cd\u590d\u7684\u4ee3\u7801\u5c01\u88c5\u6210\u51fd\u6570\uff0c\u53ef\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002\u7c7b\u662f\u9762\u5411\u5bf9\u8c61\u7f16\u7a0b\u7684\u57fa\u672c\u5355\u5143\uff0c\u901a\u8fc7\u5c06\u6570\u636e\u548c\u64cd\u4f5c\u5c01\u88c5\u5728\u4e00\u8d77\uff0c\u53ef\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u91cd\u7528\u6027\u548c\u53ef\u6269\u5c55\u6027\u3002\u6a21\u5757\u662fPython\u4e2d\u7684\u4e00\u4e2a\u6587\u4ef6\uff0c\u53ef\u4ee5\u5305\u542b\u591a\u4e2a\u51fd\u6570\u548c\u7c7b\uff0c\u901a\u8fc7\u5bfc\u5165\u6a21\u5757\u53ef\u4ee5\u5b9e\u73b0\u4ee3\u7801\u7684\u91cd\u7528\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># Example of a simple function<\/p>\n<p>def add(a, b):<\/p>\n<p>    return a + b<\/p>\n<h2><strong>Example of a simple class<\/strong><\/h2>\n<p>class Calculator:<\/p>\n<p>    def __init__(self):<\/p>\n<p>        self.result = 0<\/p>\n<p>    def add(self, a, b):<\/p>\n<p>        self.result = a + b<\/p>\n<p>        return self.result<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u6a21\u5757\u7684\u7ec4\u7ec7\u548c\u7ba1\u7406<\/h4>\n<\/p>\n<p><p>\u5728\u7f16\u5199\u8bbe\u8ba1\u8ba1\u7b97\u7a0b\u5e8f\u65f6\uff0c\u9700\u8981\u5408\u7406\u7ec4\u7ec7\u548c\u7ba1\u7406\u6a21\u5757\u3002\u53ef\u4ee5\u5c06\u76f8\u5173\u7684\u6a21\u5757\u653e\u5728\u540c\u4e00\u4e2a\u76ee\u5f55\u4e0b\uff0c\u4f7f\u7528\u5305\u6765\u7ba1\u7406\u6a21\u5757\u3002\u901a\u8fc7\u5408\u7406\u7684\u6a21\u5757\u7ec4\u7ec7\u548c\u7ba1\u7406\uff0c\u53ef\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># Directory structure<\/p>\n<h2><strong>my_project\/<\/strong><\/h2>\n<h2><strong>\u251c\u2500\u2500 __init__.py<\/strong><\/h2>\n<h2><strong>\u251c\u2500\u2500 module1.py<\/strong><\/h2>\n<h2><strong>\u251c\u2500\u2500 module2.py<\/strong><\/h2>\n<h2><strong>module1.py<\/strong><\/h2>\n<p>def add(a, b):<\/p>\n<p>    return a + b<\/p>\n<h2><strong>module2.py<\/strong><\/h2>\n<p>from .module1 import add<\/p>\n<p>def subtract(a, b):<\/p>\n<p>    return a - b<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u7b97\u6cd5\u4f18\u5316<\/h3>\n<\/p>\n<p><p>\u5728\u7f16\u5199\u8bbe\u8ba1\u8ba1\u7b97\u7a0b\u5e8f\u65f6\uff0c\u7b97\u6cd5\u7684\u9009\u62e9\u548c\u4f18\u5316\u662f\u5f71\u54cd\u7a0b\u5e8f\u6027\u80fd\u7684\u91cd\u8981\u56e0\u7d20\u3002\u9009\u62e9\u5408\u9002\u7684\u7b97\u6cd5\u53ef\u4ee5\u663e\u8457\u63d0\u9ad8\u7a0b\u5e8f\u7684\u6548\u7387\u3002\u5728\u8fdb\u884c\u7b97\u6cd5\u4f18\u5316\u65f6\uff0c\u53ef\u4ee5\u8003\u8651\u4ee5\u4e0b\u51e0\u4e2a\u65b9\u9762\uff1a<\/p>\n<\/p>\n<p><h4>1\u3001\u65f6\u95f4\u590d\u6742\u5ea6\u548c\u7a7a\u95f4\u590d\u6742\u5ea6<\/h4>\n<\/p>\n<p><p>\u65f6\u95f4\u590d\u6742\u5ea6\u548c\u7a7a\u95f4\u590d\u6742\u5ea6\u662f\u8bc4<a href=\"https:\/\/docs.pingcode.com\/agile\/project-management\/estimation\" target=\"_blank\">\u4f30\u7b97<\/a>\u6cd5\u6027\u80fd\u7684\u91cd\u8981\u6307\u6807\u3002\u65f6\u95f4\u590d\u6742\u5ea6\u8868\u793a\u7b97\u6cd5\u6267\u884c\u6240\u9700\u7684\u65f6\u95f4\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6\u8868\u793a\u7b97\u6cd5\u6267\u884c\u6240\u9700\u7684\u5185\u5b58\u3002\u5728\u9009\u62e9\u7b97\u6cd5\u65f6\uff0c\u5e94\u5c3d\u91cf\u9009\u62e9\u65f6\u95f4\u590d\u6742\u5ea6\u548c\u7a7a\u95f4\u590d\u6742\u5ea6\u8f83\u4f4e\u7684\u7b97\u6cd5\u3002<\/p>\n<\/p>\n<p><h4>2\u3001\u5e38\u89c1\u7b97\u6cd5\u4f18\u5316\u65b9\u6cd5<\/h4>\n<\/p>\n<p><p>\u5e38\u89c1\u7684\u7b97\u6cd5\u4f18\u5316\u65b9\u6cd5\u5305\u62ec\u8d2a\u5fc3\u7b97\u6cd5\u3001\u52a8\u6001\u89c4\u5212\u3001\u5206\u6cbb\u7b97\u6cd5\u7b49\u3002\u8d2a\u5fc3\u7b97\u6cd5\u901a\u8fc7\u6bcf\u6b21\u9009\u62e9\u5f53\u524d\u6700\u4f18\u89e3\u6765\u83b7\u5f97\u5168\u5c40\u6700\u4f18\u89e3\uff0c\u9002\u7528\u4e8e\u4e00\u4e9b\u6700\u4f18\u5316\u95ee\u9898\u3002\u52a8\u6001\u89c4\u5212\u901a\u8fc7\u5c06\u95ee\u9898\u5206\u89e3\u6210\u5b50\u95ee\u9898\uff0c\u5e76\u4fdd\u5b58\u5b50\u95ee\u9898\u7684\u89e3\u6765\u907f\u514d\u91cd\u590d\u8ba1\u7b97\uff0c\u9002\u7528\u4e8e\u4e00\u4e9b\u5177\u6709\u91cd\u53e0\u5b50\u95ee\u9898\u548c\u6700\u4f18\u5b50\u7ed3\u6784\u6027\u8d28\u7684\u95ee\u9898\u3002\u5206\u6cbb\u7b97\u6cd5\u901a\u8fc7\u5c06\u95ee\u9898\u5206\u89e3\u6210\u82e5\u5e72\u4e2a\u5b50\u95ee\u9898\uff0c\u5206\u522b\u89e3\u51b3\u5b50\u95ee\u9898\uff0c\u7136\u540e\u5408\u5e76\u5b50\u95ee\u9898\u7684\u89e3\u6765\u89e3\u51b3\u539f\u95ee\u9898\uff0c\u9002\u7528\u4e8e\u4e00\u4e9b\u9012\u5f52\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u9519\u8bef\u5904\u7406<\/h3>\n<\/p>\n<p><p>\u5728\u7f16\u5199\u8bbe\u8ba1\u8ba1\u7b97\u7a0b\u5e8f\u65f6\uff0c\u9519\u8bef\u5904\u7406\u662f\u4fdd\u8bc1\u7a0b\u5e8f\u5065\u58ee\u6027\u548c\u7a33\u5b9a\u6027\u7684\u91cd\u8981\u73af\u8282\u3002Python\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u9519\u8bef\u5904\u7406\u673a\u5236\uff0c\u5305\u62ec\u5f02\u5e38\u5904\u7406\u3001\u65ad\u8a00\u7b49\u3002\u5728\u8fdb\u884c\u9519\u8bef\u5904\u7406\u65f6\uff0c\u53ef\u4ee5\u8003\u8651\u4ee5\u4e0b\u51e0\u4e2a\u65b9\u9762\uff1a<\/p>\n<\/p>\n<p><h4>1\u3001\u5f02\u5e38\u5904\u7406<\/h4>\n<\/p>\n<p><p>\u5f02\u5e38\u5904\u7406\u662f\u5904\u7406\u7a0b\u5e8f\u8fd0\u884c\u65f6\u9519\u8bef\u7684\u5e38\u7528\u65b9\u6cd5\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528try-except\u8bed\u53e5\u6765\u6355\u83b7\u548c\u5904\u7406\u5f02\u5e38\u3002\u901a\u8fc7\u5408\u7406\u7684\u5f02\u5e38\u5904\u7406\uff0c\u53ef\u4ee5\u63d0\u9ad8\u7a0b\u5e8f\u7684\u5065\u58ee\u6027\u548c\u7a33\u5b9a\u6027\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">try:<\/p>\n<p>    result = 10 \/ 0<\/p>\n<p>except ZeroDivisionError:<\/p>\n<p>    print(&quot;Division by zero is not allowed.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u65ad\u8a00<\/h4>\n<\/p>\n<p><p>\u65ad\u8a00\u662f\u4e00\u79cd\u8c03\u8bd5\u5de5\u5177\uff0c\u7528\u4e8e\u68c0\u67e5\u7a0b\u5e8f\u4e2d\u7684\u67d0\u4e9b\u6761\u4ef6\u662f\u5426\u6210\u7acb\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528assert\u8bed\u53e5\u6765\u8fdb\u884c\u65ad\u8a00\u3002\u5f53\u65ad\u8a00\u6761\u4ef6\u4e0d\u6210\u7acb\u65f6\uff0c\u7a0b\u5e8f\u4f1a\u629b\u51faAssertionError\u5f02\u5e38\u3002\u901a\u8fc7\u5408\u7406\u4f7f\u7528\u65ad\u8a00\uff0c\u53ef\u4ee5\u5728\u5f00\u53d1\u548c\u8c03\u8bd5\u8fc7\u7a0b\u4e2d\u53ca\u65f6\u53d1\u73b0\u548c\u4fee\u590d\u9519\u8bef\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">assert 10 &gt; 5, &quot;10 should be greater than 5&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001\u7528\u6237\u4ea4\u4e92<\/h3>\n<\/p>\n<p><p>\u7528\u6237\u4ea4\u4e92\u662f\u8bbe\u8ba1\u8ba1\u7b97\u7a0b\u5e8f\u7684\u91cd\u8981\u73af\u8282\u3002\u901a\u8fc7\u5408\u7406\u7684\u7528\u6237\u4ea4\u4e92\u8bbe\u8ba1\uff0c\u53ef\u4ee5\u63d0\u9ad8\u7a0b\u5e8f\u7684\u6613\u7528\u6027\u548c\u7528\u6237\u4f53\u9a8c\u3002\u5728\u8fdb\u884c\u7528\u6237\u4ea4\u4e92\u8bbe\u8ba1\u65f6\uff0c\u53ef\u4ee5\u8003\u8651\u4ee5\u4e0b\u51e0\u4e2a\u65b9\u9762\uff1a<\/p>\n<\/p>\n<p><h4>1\u3001\u547d\u4ee4\u884c\u4ea4\u4e92<\/h4>\n<\/p>\n<p><p>\u547d\u4ee4\u884c\u4ea4\u4e92\u662f\u5e38\u89c1\u7684\u7528\u6237\u4ea4\u4e92\u65b9\u5f0f\u4e4b\u4e00\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528input\u51fd\u6570\u6765\u83b7\u53d6\u7528\u6237\u8f93\u5165\uff0c\u4f7f\u7528print\u51fd\u6570\u6765\u8f93\u51fa\u7ed3\u679c\u3002\u901a\u8fc7\u5408\u7406\u7684\u547d\u4ee4\u884c\u4ea4\u4e92\u8bbe\u8ba1\uff0c\u53ef\u4ee5\u63d0\u9ad8\u7a0b\u5e8f\u7684\u6613\u7528\u6027\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">name = input(&quot;Please enter your name: &quot;)<\/p>\n<p>print(f&quot;Hello, {name}!&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u56fe\u5f62\u7528\u6237\u754c\u9762\uff08GUI\uff09<\/h4>\n<\/p>\n<p><p>\u56fe\u5f62\u7528\u6237\u754c\u9762\uff08GUI\uff09\u662f\u53e6\u4e00\u79cd\u5e38\u89c1\u7684\u7528\u6237\u4ea4\u4e92\u65b9\u5f0f\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528Tkinter\u3001PyQt\u7b49\u5e93\u6765\u521b\u5efa\u56fe\u5f62\u7528\u6237\u754c\u9762\u3002\u901a\u8fc7\u5408\u7406\u7684\u56fe\u5f62\u7528\u6237\u754c\u9762\u8bbe\u8ba1\uff0c\u53ef\u4ee5\u63d0\u9ad8\u7a0b\u5e8f\u7684\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import tkinter as tk<\/p>\n<p>def on_button_click():<\/p>\n<p>    label.config(text=f&quot;Hello, {entry.get()}!&quot;)<\/p>\n<p>root = tk.Tk()<\/p>\n<p>root.title(&quot;Simple GUI&quot;)<\/p>\n<p>label = tk.Label(root, text=&quot;Enter your name:&quot;)<\/p>\n<p>label.pack()<\/p>\n<p>entry = tk.Entry(root)<\/p>\n<p>entry.pack()<\/p>\n<p>button = tk.Button(root, text=&quot;Submit&quot;, command=on_button_click)<\/p>\n<p>button.pack()<\/p>\n<p>root.m<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>nloop()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u516d\u3001\u5b9e\u4f8b\u8bb2\u89e3<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u66f4\u597d\u5730\u7406\u89e3\u5982\u4f55\u4f7f\u7528Python\u7f16\u5199\u8bbe\u8ba1\u8ba1\u7b97\u7a0b\u5e8f\uff0c\u4e0b\u9762\u901a\u8fc7\u4e00\u4e2a\u5177\u4f53\u7684\u5b9e\u4f8b\u6765\u8bb2\u89e3\u3002\u5047\u8bbe\u6211\u4eec\u9700\u8981\u7f16\u5199\u4e00\u4e2a\u7a0b\u5e8f\u6765\u8ba1\u7b97\u77e9\u9635\u7684\u4e58\u6cd5\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u95ee\u9898\u5206\u89e3<\/h4>\n<\/p>\n<p><p>\u9996\u5148\u5c06\u95ee\u9898\u5206\u89e3\u6210\u82e5\u5e72\u4e2a\u5b50\u95ee\u9898\u3002\u77e9\u9635\u4e58\u6cd5\u7684\u57fa\u672c\u601d\u60f3\u662f\u5c06\u4e24\u4e2a\u77e9\u9635A\u548cB\u76f8\u4e58\uff0c\u5f97\u5230\u4e00\u4e2a\u65b0\u7684\u77e9\u9635C\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u5bf9\u4e8e\u77e9\u9635A\u7684\u7b2ci\u884c\u548c\u77e9\u9635B\u7684\u7b2cj\u5217\uff0c\u77e9\u9635C\u7684\u5143\u7d20C[i][j]\u7b49\u4e8e\u77e9\u9635A\u7684\u7b2ci\u884c\u548c\u77e9\u9635B\u7684\u7b2cj\u5217\u5bf9\u5e94\u5143\u7d20\u7684\u4e58\u79ef\u4e4b\u548c\u3002<\/p>\n<\/p>\n<p><h4>2\u3001\u8bbe\u8ba1\u6570\u636e\u7ed3\u6784<\/h4>\n<\/p>\n<p><p>\u5728\u8ba1\u7b97\u77e9\u9635\u4e58\u6cd5\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e8c\u7ef4\u5217\u8868\u6765\u8868\u793a\u77e9\u9635\u3002\u4e8c\u7ef4\u5217\u8868\u662fPython\u4e2d\u5e38\u7528\u7684\u6570\u636e\u7ed3\u6784\u4e4b\u4e00\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u8868\u793a\u548c\u64cd\u4f5c\u77e9\u9635\u3002<\/p>\n<\/p>\n<p><h4>3\u3001\u5b9e\u73b0\u6a21\u5757<\/h4>\n<\/p>\n<p><p>\u6839\u636e\u95ee\u9898\u5206\u89e3\u7684\u7ed3\u679c\uff0c\u53ef\u4ee5\u5c06\u7a0b\u5e8f\u5212\u5206\u4e3a\u82e5\u5e72\u4e2a\u6a21\u5757\u3002\u6bcf\u4e2a\u6a21\u5757\u5b9e\u73b0\u7279\u5b9a\u7684\u529f\u80fd\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u53ef\u4ee5\u5b9a\u4e49\u4e00\u4e2a\u51fd\u6570\u6765\u5b9e\u73b0\u77e9\u9635\u4e58\u6cd5\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def matrix_multiply(A, B):<\/p>\n<p>    # Get the dimensions of the matrices<\/p>\n<p>    rows_A = len(A)<\/p>\n<p>    cols_A = len(A[0])<\/p>\n<p>    rows_B = len(B)<\/p>\n<p>    cols_B = len(B[0])<\/p>\n<p>    # Check if the matrices can be multiplied<\/p>\n<p>    if cols_A != rows_B:<\/p>\n<p>        raise ValueError(&quot;The number of columns in matrix A must be equal to the number of rows in matrix B.&quot;)<\/p>\n<p>    # Initialize the result matrix<\/p>\n<p>    C = [[0 for _ in range(cols_B)] for _ in range(rows_A)]<\/p>\n<p>    # Perform matrix multiplication<\/p>\n<p>    for i in range(rows_A):<\/p>\n<p>        for j in range(cols_B):<\/p>\n<p>            for k in range(cols_A):<\/p>\n<p>                C[i][j] += A[i][k] * B[k][j]<\/p>\n<p>    return C<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4\u3001\u4e3b\u7a0b\u5e8f<\/h4>\n<\/p>\n<p><p>\u5728\u4e3b\u7a0b\u5e8f\u4e2d\uff0c\u9996\u5148\u83b7\u53d6\u7528\u6237\u8f93\u5165\u7684\u77e9\u9635A\u548c\u77e9\u9635B\uff0c\u7136\u540e\u8c03\u7528\u77e9\u9635\u4e58\u6cd5\u51fd\u6570\u8fdb\u884c\u8ba1\u7b97\uff0c\u5e76\u8f93\u51fa\u7ed3\u679c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def get_matrix_input(rows, cols):<\/p>\n<p>    matrix = []<\/p>\n<p>    for i in range(rows):<\/p>\n<p>        row = list(map(int, input(f&quot;Enter the elements of row {i+1} separated by spaces: &quot;).split()))<\/p>\n<p>        if len(row) != cols:<\/p>\n<p>            raise ValueError(&quot;The number of elements in the row must be equal to the number of columns.&quot;)<\/p>\n<p>        matrix.append(row)<\/p>\n<p>    return matrix<\/p>\n<p>if __name__ == &quot;__main__&quot;:<\/p>\n<p>    rows_A = int(input(&quot;Enter the number of rows in matrix A: &quot;))<\/p>\n<p>    cols_A = int(input(&quot;Enter the number of columns in matrix A: &quot;))<\/p>\n<p>    A = get_matrix_input(rows_A, cols_A)<\/p>\n<p>    rows_B = int(input(&quot;Enter the number of rows in matrix B: &quot;))<\/p>\n<p>    cols_B = int(input(&quot;Enter the number of columns in matrix B: &quot;))<\/p>\n<p>    B = get_matrix_input(rows_B, cols_B)<\/p>\n<p>    try:<\/p>\n<p>        C = matrix_multiply(A, B)<\/p>\n<p>        print(&quot;The result of matrix multiplication is:&quot;)<\/p>\n<p>        for row in C:<\/p>\n<p>            print(&quot; &quot;.join(map(str, row)))<\/p>\n<p>    except ValueError as e:<\/p>\n<p>        print(e)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e03\u3001\u6269\u5c55\u4e0e\u4f18\u5316<\/h3>\n<\/p>\n<p><p>\u5728\u4e0a\u8ff0\u5b9e\u4f8b\u7684\u57fa\u7840\u4e0a\uff0c\u53ef\u4ee5\u8fdb\u4e00\u6b65\u8fdb\u884c\u6269\u5c55\u548c\u4f18\u5316\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u6dfb\u52a0\u66f4\u591a\u7684\u77e9\u9635\u64cd\u4f5c\u529f\u80fd\uff0c\u5982\u77e9\u9635\u52a0\u6cd5\u3001\u77e9\u9635\u8f6c\u7f6e\u7b49\uff1b\u53ef\u4ee5\u4f18\u5316\u77e9\u9635\u4e58\u6cd5\u7684\u7b97\u6cd5\uff0c\u5982\u4f7f\u7528Strassen\u7b97\u6cd5\uff1b\u53ef\u4ee5\u6dfb\u52a0\u66f4\u591a\u7684\u7528\u6237\u4ea4\u4e92\u529f\u80fd\uff0c\u5982\u4f7f\u7528\u56fe\u5f62\u7528\u6237\u754c\u9762\u6765\u8f93\u5165\u77e9\u9635\u548c\u663e\u793a\u7ed3\u679c\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u6269\u5c55\u529f\u80fd<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u5b9a\u4e49\u66f4\u591a\u7684\u51fd\u6570\u6765\u5b9e\u73b0\u77e9\u9635\u7684\u5176\u4ed6\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u5b9a\u4e49\u4e00\u4e2a\u51fd\u6570\u6765\u5b9e\u73b0\u77e9\u9635\u52a0\u6cd5\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def matrix_add(A, B):<\/p>\n<p>    # Get the dimensions of the matrices<\/p>\n<p>    rows_A = len(A)<\/p>\n<p>    cols_A = len(A[0])<\/p>\n<p>    rows_B = len(B)<\/p>\n<p>    cols_B = len(B[0])<\/p>\n<p>    # Check if the matrices can be added<\/p>\n<p>    if rows_A != rows_B or cols_A != cols_B:<\/p>\n<p>        raise ValueError(&quot;The dimensions of the matrices must be the same.&quot;)<\/p>\n<p>    # Initialize the result matrix<\/p>\n<p>    C = [[0 for _ in range(cols_A)] for _ in range(rows_A)]<\/p>\n<p>    # Perform matrix addition<\/p>\n<p>    for i in range(rows_A):<\/p>\n<p>        for j in range(cols_A):<\/p>\n<p>            C[i][j] = A[i][j] + B[i][j]<\/p>\n<p>    return C<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u4f18\u5316\u7b97\u6cd5<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528Strassen\u7b97\u6cd5\u6765\u4f18\u5316\u77e9\u9635\u4e58\u6cd5\u7684\u6548\u7387\u3002Strassen\u7b97\u6cd5\u662f\u4e00\u79cd\u5206\u6cbb\u7b97\u6cd5\uff0c\u901a\u8fc7\u5c06\u77e9\u9635\u5206\u6210\u82e5\u5e72\u4e2a\u5b50\u77e9\u9635\uff0c\u5e76\u5bf9\u5b50\u77e9\u9635\u8fdb\u884c\u9012\u5f52\u4e58\u6cd5\uff0c\u4ece\u800c\u51cf\u5c11\u4e58\u6cd5\u8fd0\u7b97\u7684\u6b21\u6570\uff0c\u63d0\u9ad8\u8ba1\u7b97\u6548\u7387\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def strassen_matrix_multiply(A, B):<\/p>\n<p>    # Base case: 1x1 matrix<\/p>\n<p>    if len(A) == 1 and len(A[0]) == 1 and len(B) == 1 and len(B[0]) == 1:<\/p>\n<p>        return [[A[0][0] * B[0][0]]]<\/p>\n<p>    # Split the matrices into submatrices<\/p>\n<p>    mid = len(A) \/\/ 2<\/p>\n<p>    A11, A12, A21, A22 = A[:mid][:mid], A[:mid][mid:], A[mid:][:mid], A[mid:][mid:]<\/p>\n<p>    B11, B12, B21, B22 = B[:mid][:mid], B[:mid][mid:], B[mid:][:mid], B[mid:][mid:]<\/p>\n<p>    # Compute the intermediate matrices<\/p>\n<p>    M1 = strassen_matrix_multiply(matrix_add(A11, A22), matrix_add(B11, B22))<\/p>\n<p>    M2 = strassen_matrix_multiply(matrix_add(A21, A22), B11)<\/p>\n<p>    M3 = strassen_matrix_multiply(A11, matrix_subtract(B12, B22))<\/p>\n<p>    M4 = strassen_matrix_multiply(A22, matrix_subtract(B21, B11))<\/p>\n<p>    M5 = strassen_matrix_multiply(matrix_add(A11, A12), B22)<\/p>\n<p>    M6 = strassen_matrix_multiply(matrix_subtract(A21, A11), matrix_add(B11, B12))<\/p>\n<p>    M7 = strassen_matrix_multiply(matrix_subtract(A12, A22), matrix_add(B21, B22))<\/p>\n<p>    # Compute the result submatrices<\/p>\n<p>    C11 = matrix_add(matrix_subtract(matrix_add(M1, M4), M5), M7)<\/p>\n<p>    C12 = matrix_add(M3, M5)<\/p>\n<p>    C21 = matrix_add(M2, M4)<\/p>\n<p>    C22 = matrix_add(matrix_subtract(matrix_add(M1, M3), M2), M6)<\/p>\n<p>    # Combine the result submatrices into the final result matrix<\/p>\n<p>    C = [[0 for _ in range(len(B[0]))] for _ in range(len(A))]<\/p>\n<p>    for i in range(mid):<\/p>\n<p>        for j in range(mid):<\/p>\n<p>            C[i][j] = C11[i][j]<\/p>\n<p>            C[i][j+mid] = C12[i][j]<\/p>\n<p>            C[i+mid][j] = C21[i][j]<\/p>\n<p>            C[i+mid][j+mid] = C22[i][j]<\/p>\n<p>    return C<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3\u3001\u56fe\u5f62\u7528\u6237\u754c\u9762<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528Tkinter\u5e93\u6765\u521b\u5efa\u56fe\u5f62\u7528\u6237\u754c\u9762\uff0c\u4f7f\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u56fe\u5f62\u754c\u9762\u8f93\u5165\u77e9\u9635\u548c\u663e\u793a\u7ed3\u679c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import tkinter as tk<\/p>\n<p>from tkinter import messagebox<\/p>\n<p>def get_matrix_input_gui(rows, cols):<\/p>\n<p>    matrix = []<\/p>\n<p>    for i in range(rows):<\/p>\n<p>        row = []<\/p>\n<p>        for j in range(cols):<\/p>\n<p>            entry = tk.Entry(root)<\/p>\n<p>            entry.grid(row=i, column=j)<\/p>\n<p>            row.append(entry)<\/p>\n<p>        matrix.append(row)<\/p>\n<p>    return matrix<\/p>\n<p>def on_submit():<\/p>\n<p>    try:<\/p>\n<p>        A = [[int(entry.get()) for entry in row] for row in matrix_A_entries]<\/p>\n<p>        B = [[int(entry.get()) for entry in row] for row in matrix_B_entries]<\/p>\n<p>        C = matrix_multiply(A, B)<\/p>\n<p>        result_text.set(&#39;\\n&#39;.join([&#39; &#39;.join(map(str, row)) for row in C]))<\/p>\n<p>    except ValueError as e:<\/p>\n<p>        messagebox.showerror(&quot;Error&quot;, str(e))<\/p>\n<p>root = tk.Tk()<\/p>\n<p>root.title(&quot;Matrix Multiplication&quot;)<\/p>\n<p>tk.Label(root, text=&quot;Matrix A&quot;).grid(row=0, column=0)<\/p>\n<p>rows_A = int(input(&quot;Enter the number of rows in matrix A: &quot;))<\/p>\n<p>cols_A = int(input(&quot;Enter the number of columns in matrix A: &quot;))<\/p>\n<p>matrix_A_entries = get_matrix_input_gui(rows_A, cols_A)<\/p>\n<p>tk.Label(root, text=&quot;Matrix B&quot;).grid(row=rows_A, column=0)<\/p>\n<p>rows_B = int(input(&quot;Enter the number of rows in matrix B: &quot;))<\/p>\n<p>cols_B = int(input(&quot;Enter the number of columns in matrix B: &quot;))<\/p>\n<p>matrix_B_entries = get_matrix_input_gui(rows_B, cols_B)<\/p>\n<p>tk.Button(root, text=&quot;Submit&quot;, command=on_submit).grid(row=rows_A+rows_B, column=0)<\/p>\n<p>result_text = tk.StringVar()<\/p>\n<p>tk.Label(root, textvariable=result_text).grid(row=rows_A+rows_B+1, column=0)<\/p>\n<p>root.mainloop()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Python\u7f16\u5199\u4e00\u4e2a\u529f\u80fd\u5b8c\u5584\u3001\u7ed3\u6784\u6e05\u6670\u7684\u8bbe\u8ba1\u8ba1\u7b97\u7a0b\u5e8f\u3002\u901a\u8fc7\u5408\u7406\u7684\u7ed3\u6784\u5316\u8bbe\u8ba1\u3001\u6a21\u5757\u5316\u7f16\u7a0b\u3001\u7b97\u6cd5\u4f18\u5316\u3001\u9519\u8bef\u5904\u7406\u548c\u7528\u6237\u4ea4\u4e92\u8bbe\u8ba1\uff0c\u53ef\u4ee5\u63d0\u9ad8\u7a0b\u5e8f\u7684\u6548\u7387\u548c\u7528\u6237\u4f53\u9a8c\u3002\u6b64\u5916\uff0c\u901a\u8fc7\u6269\u5c55\u548c\u4f18\u5316\uff0c\u53ef\u4ee5\u8fdb\u4e00\u6b65\u63d0\u9ad8\u7a0b\u5e8f\u7684\u529f\u80fd\u548c\u6027\u80fd\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u9009\u62e9\u5408\u9002\u7684Python\u5e93\u6765\u7f16\u5199\u8bbe\u8ba1\u8ba1\u7b97\u7a0b\u5e8f\uff1f<\/strong><br \/>\u5728\u7f16\u5199\u8bbe\u8ba1\u8ba1\u7b97\u7a0b\u5e8f\u65f6\uff0c\u9009\u62e9\u5408\u9002\u7684Python\u5e93\u81f3\u5173\u91cd\u8981\u3002\u5e38\u7528\u7684\u5e93\u5305\u62ecNumPy\u3001SciPy\u548cPandas\u7b49\u3002NumPy\u63d0\u4f9b\u4e86\u9ad8\u6548\u7684\u6570\u7ec4\u8fd0\u7b97\u548c\u6570\u5b66\u51fd\u6570\uff0cSciPy\u5219\u4e13\u6ce8\u4e8e\u79d1\u5b66\u8ba1\u7b97\uff0c\u63d0\u4f9b\u4e86\u4f18\u5316\u3001\u79ef\u5206\u3001\u63d2\u503c\u7b49\u529f\u80fd\uff0c\u800cPandas\u5219\u9002\u7528\u4e8e\u6570\u636e\u5904\u7406\u548c\u5206\u6790\u3002\u6839\u636e\u9879\u76ee\u9700\u6c42\uff0c\u5408\u7406\u9009\u62e9\u8fd9\u4e9b\u5e93\uff0c\u53ef\u4ee5\u663e\u8457\u63d0\u9ad8\u7a0b\u5e8f\u7684\u6027\u80fd\u548c\u53ef\u8bfb\u6027\u3002<\/p>\n<p><strong>\u5728Python\u4e2d\u5b9e\u73b0\u8ba1\u7b97\u7a0b\u5e8f\u65f6\uff0c\u5982\u4f55\u786e\u4fdd\u4ee3\u7801\u7684\u53ef\u7ef4\u62a4\u6027\u548c\u53ef\u8bfb\u6027\uff1f<\/strong><br \/>\u4e3a\u4e86\u786e\u4fdd\u4ee3\u7801\u7684\u53ef\u7ef4\u62a4\u6027\u548c\u53ef\u8bfb\u6027\uff0c\u5efa\u8bae\u9075\u5faaPEP 8\u7f16\u7801\u89c4\u8303\uff0c\u4f7f\u7528\u6e05\u6670\u7684\u53d8\u91cf\u548c\u51fd\u6570\u547d\u540d\uff0c\u5e76\u6dfb\u52a0\u9002\u5f53\u7684\u6ce8\u91ca\u3002\u6b64\u5916\uff0c\u5408\u7406\u7ec4\u7ec7\u4ee3\u7801\u7ed3\u6784\uff0c\u4f7f\u7528\u6a21\u5757\u5316\u8bbe\u8ba1\uff0c\u53ef\u4ee5\u4f7f\u7a0b\u5e8f\u66f4\u6613\u4e8e\u7406\u89e3\u548c\u4fee\u6539\u3002\u7f16\u5199\u5355\u5143\u6d4b\u8bd5\u4e5f\u662f\u4e00\u79cd\u786e\u4fdd\u4ee3\u7801\u8d28\u91cf\u7684\u91cd\u8981\u65b9\u6cd5\uff0c\u5b83\u80fd\u5e2e\u52a9\u4f60\u5728\u4fee\u6539\u7a0b\u5e8f\u65f6\u53ca\u65f6\u53d1\u73b0\u6f5c\u5728\u7684\u95ee\u9898\u3002<\/p>\n<p><strong>\u662f\u5426\u6709\u63a8\u8350\u7684\u5728\u7ebf\u8d44\u6e90\u6216\u6559\u7a0b\u6765\u5b66\u4e60Python\u8bbe\u8ba1\u8ba1\u7b97\u7a0b\u5e8f\u7684\u6280\u5de7\uff1f<\/strong><br \/>\u786e\u5b9e\u6709\u5f88\u591a\u4f18\u79c0\u7684\u5728\u7ebf\u8d44\u6e90\u53ef\u4f9b\u5b66\u4e60\u3002\u4f8b\u5982\uff0cCoursera\u548cedX\u4e0a\u6709\u591a\u95e8\u4e0ePython\u76f8\u5173\u7684\u8bfe\u7a0b\uff0c\u6d89\u53ca\u79d1\u5b66\u8ba1\u7b97\u3001\u6570\u636e\u5206\u6790\u7b49\u65b9\u9762\u3002\u6b64\u5916\uff0cYouTube\u4e0a\u4e5f\u6709\u5f88\u591a\u7f16\u7a0b\u6559\u7a0b\uff0c\u80fd\u591f\u5e2e\u52a9\u4f60\u66f4\u76f4\u89c2\u5730\u7406\u89e3Python\u7684\u8bbe\u8ba1\u8ba1\u7b97\u7a0b\u5e8f\u7f16\u5199\u6280\u5de7\u3002\u6b64\u5916\uff0cStack Overflow\u548cGitHub\u662f\u67e5\u627e\u7279\u5b9a\u95ee\u9898\u89e3\u51b3\u65b9\u6848\u548c\u4ee3\u7801\u793a\u4f8b\u7684\u597d\u5730\u65b9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u7f16\u5199\u8bbe\u8ba1\u8ba1\u7b97\u7a0b\u5e8f\u65f6\uff0c\u9700\u8003\u8651\u7a0b\u5e8f\u7684\u7ed3\u6784\u5316\u8bbe\u8ba1\u3001\u7b97\u6cd5\u7684\u9009\u62e9\u4e0e\u4f18\u5316\u3001\u6a21\u5757\u5316\u7f16\u7a0b\u3001\u9519\u8bef\u5904\u7406\u548c\u7528\u6237\u4ea4\u4e92\u7b49\u65b9\u9762 [&hellip;]","protected":false},"author":3,"featured_media":1187072,"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\/1187066"}],"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=1187066"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1187066\/revisions"}],"predecessor-version":[{"id":1187074,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1187066\/revisions\/1187074"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1187072"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1187066"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1187066"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1187066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}