{"id":1002546,"date":"2024-12-27T10:09:34","date_gmt":"2024-12-27T02:09:34","guid":{"rendered":""},"modified":"2024-12-27T10:09:37","modified_gmt":"2024-12-27T02:09:37","slug":"python%e4%bb%a3%e7%a0%81%e5%a6%82%e4%bd%95%e5%88%86%e6%ae%b5%e8%bf%90%e8%a1%8c","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1002546.html","title":{"rendered":"python\u4ee3\u7801\u5982\u4f55\u5206\u6bb5\u8fd0\u884c"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25080244\/0e720c9d-afca-4ff4-89d3-2436f8293d25.webp\" alt=\"python\u4ee3\u7801\u5982\u4f55\u5206\u6bb5\u8fd0\u884c\" \/><\/p>\n<p><p> <strong>\u8981\u5728Python\u4e2d\u5b9e\u73b0\u4ee3\u7801\u5206\u6bb5\u8fd0\u884c\uff0c\u53ef\u4ee5\u4f7f\u7528\u51fd\u6570\u3001\u6761\u4ef6\u8bed\u53e5\u3001\u5faa\u73af\u7ed3\u6784\u3001Jupyter Notebook\u5355\u5143\u683c\u7b49\u65b9\u6cd5\u3002<\/strong>\u5176\u4e2d\uff0c\u4f7f\u7528\u51fd\u6570\u662f\u6700\u5e38\u89c1\u548c\u9ad8\u6548\u7684\u65b9\u6cd5\uff0c\u5b83\u4e0d\u4ec5\u53ef\u4ee5\u8ba9\u4ee3\u7801\u66f4\u6709\u7ec4\u7ec7\u6027\uff0c\u8fd8\u80fd\u591f\u63d0\u9ad8\u4ee3\u7801\u7684\u91cd\u7528\u6027\u548c\u53ef\u8bfb\u6027\u3002\u901a\u8fc7\u5c06\u4ee3\u7801\u5757\u5206\u6210\u4e0d\u540c\u7684\u51fd\u6570\uff0c\u6bcf\u4e2a\u51fd\u6570\u6267\u884c\u4e00\u4e2a\u7279\u5b9a\u7684\u4efb\u52a1\uff0c\u4f60\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8c03\u7528\u8fd9\u4e9b\u51fd\u6570\uff0c\u4ece\u800c\u5b9e\u73b0\u5206\u6bb5\u8fd0\u884c\u3002\u4e0b\u9762\u8be6\u7ec6\u4ecb\u7ecd\u4f7f\u7528\u51fd\u6570\u7684\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><p>\u51fd\u6570\u5728Python\u4e2d\u662f\u901a\u8fc7 <code>def<\/code> \u5173\u952e\u5b57\u5b9a\u4e49\u7684\uff0c\u5b83\u5141\u8bb8\u4f60\u5c06\u4ee3\u7801\u903b\u8f91\u5c01\u88c5\u5230\u4e00\u4e2a\u547d\u540d\u7684\u5757\u4e2d\u3002\u5f53\u4f60\u9700\u8981\u8fd0\u884c\u8fd9\u4e2a\u4ee3\u7801\u5757\u65f6\uff0c\u53ea\u9700\u8c03\u7528\u51fd\u6570\u540d\u5373\u53ef\u3002\u51fd\u6570\u7684\u4f7f\u7528\u53ef\u4ee5\u5e2e\u52a9\u4f60\u907f\u514d\u4ee3\u7801\u91cd\u590d\uff0c\u8fd8\u53ef\u4ee5\u65b9\u4fbf\u5730\u8fdb\u884c\u8c03\u8bd5\u548c\u6d4b\u8bd5\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u6709\u4e00\u4e2a\u590d\u6742\u7684\u8fd0\u7b97\u9700\u8981\u5728\u4e0d\u540c\u7684\u5730\u65b9\u4f7f\u7528\uff0c\u4f60\u53ef\u4ee5\u5c06\u5176\u5c01\u88c5\u6210\u4e00\u4e2a\u51fd\u6570\uff0c\u7136\u540e\u5728\u9700\u8981\u7684\u5730\u65b9\u8c03\u7528\u8fd9\u4e2a\u51fd\u6570\uff0c\u800c\u4e0d\u5fc5\u91cd\u590d\u7f16\u5199\u4ee3\u7801\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528\u51fd\u6570\u8fdb\u884c\u5206\u6bb5\u8fd0\u884c<\/h3>\n<\/p>\n<p><p>Python\u4e2d\u7684\u51fd\u6570\u662f\u5c06\u4ee3\u7801\u903b\u8f91\u5c01\u88c5\u5230\u4e00\u4e2a\u5355\u72ec\u7684\u547d\u540d\u5757\u4e2d\u7684\u6700\u4f73\u65b9\u5f0f\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8c03\u7528\u51fd\u6570\uff0c\u4ece\u800c\u5b9e\u73b0\u4ee3\u7801\u7684\u5206\u6bb5\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><h4>1. \u51fd\u6570\u7684\u5b9a\u4e49\u4e0e\u8c03\u7528<\/h4>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u51fd\u6570\u901a\u8fc7<code>def<\/code>\u5173\u952e\u5b57\u5b9a\u4e49\u3002\u5b9a\u4e49\u51fd\u6570\u65f6\uff0c\u9700\u8981\u6307\u5b9a\u51fd\u6570\u540d\u548c\u53c2\u6570\uff08\u5982\u679c\u6709\u7684\u8bdd\uff09\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u51fd\u6570\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def greet(name):<\/p>\n<p>    print(f&quot;Hello, {name}!&quot;)<\/p>\n<h2><strong>\u8c03\u7528\u51fd\u6570<\/strong><\/h2>\n<p>greet(&quot;Alice&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u8ff0\u793a\u4f8b\u4e2d\uff0c\u51fd\u6570<code>greet<\/code>\u88ab\u5b9a\u4e49\u4e3a\u63a5\u53d7\u4e00\u4e2a\u53c2\u6570<code>name<\/code>\uff0c\u5e76\u6253\u5370\u51fa\u4e00\u6761\u95ee\u5019\u6d88\u606f\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u8c03\u7528<code>greet<\/code>\u51fd\u6570\u5e76\u4f20\u9012\u4e00\u4e2a\u540d\u5b57\u6765\u8fd0\u884c\u8fd9\u4e2a\u4ee3\u7801\u5757\u3002<\/p>\n<\/p>\n<p><h4>2. \u53c2\u6570\u4e0e\u8fd4\u56de\u503c<\/h4>\n<\/p>\n<p><p>\u51fd\u6570\u53ef\u4ee5\u63a5\u53d7\u591a\u4e2a\u53c2\u6570\uff0c\u5e76\u8fd4\u56de\u4e00\u4e2a\u6216\u591a\u4e2a\u503c\u3002\u901a\u8fc7\u4f7f\u7528\u8fd4\u56de\u503c\uff0c\u53ef\u4ee5\u5c06\u51fd\u6570\u7684\u7ed3\u679c\u4f20\u9012\u7ed9\u5176\u4ed6\u4ee3\u7801\u6bb5\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def add(a, b):<\/p>\n<p>    return a + b<\/p>\n<p>result = add(5, 3)<\/p>\n<p>print(result)  # \u8f93\u51fa: 8<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u51fd\u6570<code>add<\/code>\u63a5\u53d7\u4e24\u4e2a\u53c2\u6570<code>a<\/code>\u548c<code>b<\/code>\uff0c\u5e76\u8fd4\u56de\u5b83\u4eec\u7684\u548c\u3002\u8fd4\u56de\u503c\u53ef\u4ee5\u7528\u4e8e\u5176\u4ed6\u8ba1\u7b97\u6216\u6253\u5370\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528\u6761\u4ef6\u8bed\u53e5\u5206\u6bb5\u8fd0\u884c<\/h3>\n<\/p>\n<p><p>\u6761\u4ef6\u8bed\u53e5\u53ef\u4ee5\u63a7\u5236\u4ee3\u7801\u7684\u6267\u884c\u8def\u5f84\uff0c\u4ece\u800c\u5b9e\u73b0\u5206\u6bb5\u8fd0\u884c\u3002\u901a\u8fc7<code>if<\/code>\u3001<code>elif<\/code>\u548c<code>else<\/code>\u8bed\u53e5\uff0c\u4f60\u53ef\u4ee5\u6839\u636e\u6761\u4ef6\u6267\u884c\u4e0d\u540c\u7684\u4ee3\u7801\u5757\u3002<\/p>\n<\/p>\n<p><h4>1. \u57fa\u672c\u6761\u4ef6\u8bed\u53e5<\/h4>\n<\/p>\n<p><p>\u4e0b\u9762\u662f\u4e00\u4e2a\u4f7f\u7528\u6761\u4ef6\u8bed\u53e5\u7684\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">x = 10<\/p>\n<p>if x &gt; 0:<\/p>\n<p>    print(&quot;x is positive&quot;)<\/p>\n<p>elif x == 0:<\/p>\n<p>    print(&quot;x is zero&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;x is negative&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u7a0b\u5e8f\u6839\u636e\u53d8\u91cf<code>x<\/code>\u7684\u503c\u6267\u884c\u4e0d\u540c\u7684\u4ee3\u7801\u5757\u3002<\/p>\n<\/p>\n<p><h4>2. \u5d4c\u5957\u6761\u4ef6\u8bed\u53e5<\/h4>\n<\/p>\n<p><p>\u6761\u4ef6\u8bed\u53e5\u53ef\u4ee5\u5d4c\u5957\u4f7f\u7528\uff0c\u4ee5\u5904\u7406\u66f4\u590d\u6742\u7684\u903b\u8f91\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">x = 10<\/p>\n<p>y = 5<\/p>\n<p>if x &gt; 0:<\/p>\n<p>    if y &gt; 0:<\/p>\n<p>        print(&quot;x and y are positive&quot;)<\/p>\n<p>    else:<\/p>\n<p>        print(&quot;x is positive, but y is not positive&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;x is not positive&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u79cd\u7ed3\u6784\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5b9e\u73b0\u66f4\u590d\u6742\u7684\u903b\u8f91\u5224\u65ad\uff0c\u4ece\u800c\u5728\u4e0d\u540c\u60c5\u51b5\u4e0b\u6267\u884c\u4e0d\u540c\u7684\u4ee3\u7801\u6bb5\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528\u5faa\u73af\u7ed3\u6784\u5206\u6bb5\u8fd0\u884c<\/h3>\n<\/p>\n<p><p>\u5faa\u73af\u7ed3\u6784\u5141\u8bb8\u4f60\u5728\u6ee1\u8db3\u7279\u5b9a\u6761\u4ef6\u65f6\u591a\u6b21\u6267\u884c\u4ee3\u7801\u6bb5\u3002Python\u4e2d\u5e38\u7528\u7684\u5faa\u73af\u7ed3\u6784\u5305\u62ec<code>for<\/code>\u5faa\u73af\u548c<code>while<\/code>\u5faa\u73af\u3002<\/p>\n<\/p>\n<p><h4>1. <code>for<\/code>\u5faa\u73af<\/h4>\n<\/p>\n<p><p><code>for<\/code>\u5faa\u73af\u7528\u4e8e\u904d\u5386\u53ef\u8fed\u4ee3\u5bf9\u8c61\uff08\u5982\u5217\u8868\u3001\u5143\u7ec4\u3001\u5b57\u7b26\u4e32\u7b49\uff09\uff0c\u5e76\u5bf9\u6bcf\u4e2a\u5143\u7d20\u6267\u884c\u4ee3\u7801\u6bb5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">numbers = [1, 2, 3, 4, 5]<\/p>\n<p>for num in numbers:<\/p>\n<p>    print(num)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c<code>for<\/code>\u5faa\u73af\u904d\u5386\u5217\u8868\u4e2d\u7684\u6bcf\u4e2a\u6570\u5b57\uff0c\u5e76\u5c06\u5176\u6253\u5370\u3002<\/p>\n<\/p>\n<p><h4>2. <code>while<\/code>\u5faa\u73af<\/h4>\n<\/p>\n<p><p><code>while<\/code>\u5faa\u73af\u7528\u4e8e\u5728\u6761\u4ef6\u4e3a\u771f\u65f6\u91cd\u590d\u6267\u884c\u4ee3\u7801\u6bb5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">count = 0<\/p>\n<p>while count &lt; 5:<\/p>\n<p>    print(count)<\/p>\n<p>    count += 1<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c<code>while<\/code>\u5faa\u73af\u5c06\u7ee7\u7eed\u6267\u884c\u4ee3\u7801\u5757\uff0c\u76f4\u5230\u53d8\u91cf<code>count<\/code>\u7684\u503c\u4e0d\u518d\u5c0f\u4e8e5\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u4f7f\u7528Jupyter Notebook\u5355\u5143\u683c<\/h3>\n<\/p>\n<p><p>\u5728\u4f7f\u7528Jupyter Notebook\u65f6\uff0c\u53ef\u4ee5\u5c06\u4ee3\u7801\u5206\u6210\u4e0d\u540c\u7684\u5355\u5143\u683c\uff0c\u5e76\u6839\u636e\u9700\u8981\u5355\u72ec\u8fd0\u884c\u6bcf\u4e2a\u5355\u5143\u683c\u3002\u8fd9\u79cd\u65b9\u6cd5\u7279\u522b\u9002\u7528\u4e8e\u6570\u636e\u5206\u6790\u3001<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u7b49\u9700\u8981\u4ea4\u4e92\u5f0f\u5f00\u53d1\u7684\u573a\u666f\u3002<\/p>\n<\/p>\n<p><h4>1. \u5355\u5143\u683c\u7684\u4f7f\u7528<\/h4>\n<\/p>\n<p><p>\u5728Jupyter Notebook\u4e2d\uff0c\u4f60\u53ef\u4ee5\u5728\u5355\u72ec\u7684\u5355\u5143\u683c\u4e2d\u7f16\u5199\u4ee3\u7801\uff0c\u5e76\u901a\u8fc7\u8fd0\u884c\u6309\u94ae\u6216\u5feb\u6377\u952e\u8fd0\u884c\u7279\u5b9a\u7684\u5355\u5143\u683c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u5355\u5143\u683c 1<\/p>\n<p>def square(x):<\/p>\n<p>    return x * x<\/p>\n<h2><strong>\u5355\u5143\u683c 2<\/strong><\/h2>\n<p>result = square(4)<\/p>\n<p>print(result)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u6570\u636e\u53ef\u89c6\u5316<\/h4>\n<\/p>\n<p><p>Jupyter Notebook\u8fd8\u652f\u6301\u6570\u636e\u53ef\u89c6\u5316\u5e93\uff08\u5982Matplotlib\u3001Seaborn\u7b49\uff09\u7684\u5206\u6bb5\u8fd0\u884c\uff0c\u4ee5\u4fbf\u9010\u6b65\u6784\u5efa\u548c\u8c03\u8bd5\u53ef\u89c6\u5316\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<h2><strong>\u5355\u5143\u683c 1<\/strong><\/h2>\n<p>x = [1, 2, 3, 4, 5]<\/p>\n<p>y = [1, 4, 9, 16, 25]<\/p>\n<h2><strong>\u5355\u5143\u683c 2<\/strong><\/h2>\n<p>plt.plot(x, y)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u5c06\u4ee3\u7801\u5206\u6210\u4e0d\u540c\u5355\u5143\u683c\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u5730\u8c03\u6574\u548c\u8fd0\u884c\u6bcf\u4e2a\u6b65\u9aa4\uff0c\u4ece\u800c\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u548c\u8c03\u8bd5\u80fd\u529b\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u4f7f\u7528\u5f02\u5e38\u5904\u7406\u8fdb\u884c\u5206\u6bb5\u8fd0\u884c<\/h3>\n<\/p>\n<p><p>\u5f02\u5e38\u5904\u7406\u5141\u8bb8\u4f60\u5728\u8fd0\u884c\u65f6\u6355\u83b7\u5e76\u5904\u7406\u9519\u8bef\uff0c\u4ece\u800c\u9632\u6b62\u7a0b\u5e8f\u5d29\u6e83\u3002\u901a\u8fc7\u4f7f\u7528<code>try<\/code>\u3001<code>except<\/code>\u8bed\u53e5\uff0c\u4f60\u53ef\u4ee5\u5728\u4ee3\u7801\u4e2d\u5b9a\u4e49\u51fa\u9519\u65f6\u7684\u5904\u7406\u903b\u8f91\uff0c\u4ece\u800c\u5b9e\u73b0\u5206\u6bb5\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><h4>1. \u57fa\u672c\u5f02\u5e38\u5904\u7406<\/h4>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u57fa\u672c\u7684\u5f02\u5e38\u5904\u7406\u793a\u4f8b\uff1a<\/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;Cannot divide by zero&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u7a0b\u5e8f\u5c1d\u8bd5\u6267\u884c\u9664\u4ee5\u96f6\u7684\u64cd\u4f5c\uff0c\u8fd9\u5c06\u5bfc\u81f4<code>ZeroDivisionError<\/code>\u3002\u901a\u8fc7\u5f02\u5e38\u5904\u7406\uff0c\u7a0b\u5e8f\u4e0d\u4f1a\u5d29\u6e83\uff0c\u800c\u662f\u4f1a\u6253\u5370\u4e00\u6761\u9519\u8bef\u6d88\u606f\u3002<\/p>\n<\/p>\n<p><h4>2. \u6355\u83b7\u591a\u4e2a\u5f02\u5e38<\/h4>\n<\/p>\n<p><p>\u4f60\u53ef\u4ee5\u6355\u83b7\u5e76\u5904\u7406\u591a\u79cd\u7c7b\u578b\u7684\u5f02\u5e38\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">try:<\/p>\n<p>    result = int(&quot;not a number&quot;)<\/p>\n<p>except ValueError:<\/p>\n<p>    print(&quot;Invalid literal for int&quot;)<\/p>\n<p>except ZeroDivisionError:<\/p>\n<p>    print(&quot;Cannot divide by zero&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u79cd\u7ed3\u6784\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5728\u4e0d\u540c\u7684\u9519\u8bef\u60c5\u51b5\u4e0b\u6267\u884c\u4e0d\u540c\u7684\u4ee3\u7801\u6bb5\uff0c\u4ece\u800c\u63d0\u9ad8\u4ee3\u7801\u7684\u5065\u58ee\u6027\u3002<\/p>\n<\/p>\n<p><p>\u7efc\u4e0a\u6240\u8ff0\uff0c\u901a\u8fc7\u4f7f\u7528\u51fd\u6570\u3001\u6761\u4ef6\u8bed\u53e5\u3001\u5faa\u73af\u7ed3\u6784\u3001Jupyter Notebook\u5355\u5143\u683c\u548c\u5f02\u5e38\u5904\u7406\uff0c\u4f60\u53ef\u4ee5\u5728Python\u4e2d\u5b9e\u73b0\u4ee3\u7801\u5206\u6bb5\u8fd0\u884c\u3002\u8fd9\u4e9b\u65b9\u6cd5\u4e0d\u4ec5\u6709\u52a9\u4e8e\u7ec4\u7ec7\u548c\u7ba1\u7406\u4ee3\u7801\uff0c\u8fd8\u53ef\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u7ef4\u62a4\u6027\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u8fdb\u884c\u4ee3\u7801\u5206\u6bb5\uff0c\u662f\u63d0\u9ad8\u7f16\u7a0b\u6548\u7387\u548c\u4ee3\u7801\u8d28\u91cf\u7684\u5173\u952e\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u5b9e\u73b0\u4ee3\u7801\u7684\u5206\u6bb5\u8fd0\u884c\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u51fd\u6570\u3001\u7c7b\u6216\u6a21\u5757\u6765\u5c06\u4ee3\u7801\u5206\u6bb5\u3002\u5c06\u4ee3\u7801\u5c01\u88c5\u5728\u51fd\u6570\u4e2d\u53ef\u4ee5\u5b9e\u73b0\u903b\u8f91\u7684\u5206\u79bb\uff0c\u5e76\u5728\u9700\u8981\u65f6\u8c03\u7528\u7279\u5b9a\u7684\u6bb5\u843d\u3002\u6b64\u5916\uff0c\u60a8\u8fd8\u53ef\u4ee5\u5229\u7528Jupyter Notebook\u7b49\u5de5\u5177\uff0c\u901a\u8fc7\u5355\u5143\u683c\u7684\u65b9\u5f0f\u5206\u6bb5\u8fd0\u884c\u4ee3\u7801\uff0c\u6bcf\u4e2a\u5355\u5143\u683c\u7684\u8f93\u51fa\u53ef\u4ee5\u76f4\u63a5\u5728\u4e0b\u65b9\u67e5\u770b\u3002<\/p>\n<p><strong>\u4f7f\u7528Jupyter Notebook\u8fdb\u884c\u4ee3\u7801\u5206\u6bb5\u8fd0\u884c\u7684\u597d\u5904\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>Jupyter Notebook\u5141\u8bb8\u7528\u6237\u5728\u4ea4\u4e92\u5f0f\u73af\u5883\u4e2d\u7f16\u5199\u548c\u6267\u884c\u4ee3\u7801\uff0c\u65b9\u4fbf\u8fdb\u884c\u9010\u6bb5\u8c03\u8bd5\u548c\u6d4b\u8bd5\u3002\u6bcf\u4e2a\u5355\u5143\u683c\u90fd\u53ef\u4ee5\u72ec\u7acb\u8fd0\u884c\uff0c\u8fd9\u6837\u53ef\u4ee5\u66f4\u597d\u5730\u63a7\u5236\u4ee3\u7801\u7684\u6267\u884c\u987a\u5e8f\u548c\u903b\u8f91\u3002\u6b64\u5916\uff0cNotebook\u652f\u6301Markdown\uff0c\u53ef\u4ee5\u5728\u4ee3\u7801\u6bb5\u4e4b\u95f4\u6dfb\u52a0\u8bf4\u660e\uff0c\u589e\u5f3a\u53ef\u8bfb\u6027\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Python\u811a\u672c\u4e2d\u5b9e\u73b0\u6761\u4ef6\u5206\u6bb5\u8fd0\u884c\uff1f<\/strong><br \/>\u5728Python\u811a\u672c\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u6761\u4ef6\u8bed\u53e5\uff08\u5982if\u8bed\u53e5\uff09\u5b9e\u73b0\u5206\u6bb5\u8fd0\u884c\u3002\u901a\u8fc7\u8bbe\u7f6e\u6761\u4ef6\uff0c\u60a8\u53ef\u4ee5\u63a7\u5236\u67d0\u4e9b\u4ee3\u7801\u5757\u7684\u6267\u884c\u3002\u4f8b\u5982\uff0c\u60a8\u53ef\u4ee5\u6839\u636e\u7528\u6237\u8f93\u5165\u6216\u5916\u90e8\u53c2\u6570\u6765\u51b3\u5b9a\u662f\u5426\u6267\u884c\u67d0\u6bb5\u4ee3\u7801\u3002\u8fd9\u79cd\u65b9\u5f0f\u975e\u5e38\u9002\u5408\u9700\u8981\u52a8\u6001\u8c03\u6574\u6267\u884c\u6d41\u7a0b\u7684\u573a\u666f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u5728Python\u4e2d\u5b9e\u73b0\u4ee3\u7801\u5206\u6bb5\u8fd0\u884c\uff0c\u53ef\u4ee5\u4f7f\u7528\u51fd\u6570\u3001\u6761\u4ef6\u8bed\u53e5\u3001\u5faa\u73af\u7ed3\u6784\u3001Jupyter Notebook\u5355\u5143\u683c\u7b49 [&hellip;]","protected":false},"author":3,"featured_media":1002555,"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\/1002546"}],"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=1002546"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1002546\/revisions"}],"predecessor-version":[{"id":1002558,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1002546\/revisions\/1002558"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1002555"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1002546"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1002546"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1002546"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}