{"id":973,"date":"2025-12-26T19:34:30","date_gmt":"2025-12-26T11:34:30","guid":{"rendered":"https:\/\/www.52runoob.com\/?p=973"},"modified":"2025-12-26T19:34:30","modified_gmt":"2025-12-26T11:34:30","slug":"python%e9%9b%b6%e5%9f%ba%e7%a1%80%e5%85%a5%e9%97%a8%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.52runoob.com\/index.php\/2025\/12\/26\/python%e9%9b%b6%e5%9f%ba%e7%a1%80%e5%85%a5%e9%97%a8%e6%95%99%e7%a8%8b\/","title":{"rendered":"python\u96f6\u57fa\u7840\u5165\u95e8\u6559\u7a0b"},"content":{"rendered":"\n<p>\u4e0b\u9762\u7ed9\u4f60\u4e00\u5957<strong>\u771f\u6b63\u9002\u5408\u96f6\u57fa\u7840\u7684 Python \u5165\u95e8\u6559\u7a0b\u8def\u7ebf<\/strong>\uff0c\u4e0d\u9700\u8981\u4efb\u4f55\u7f16\u7a0b\u80cc\u666f\uff0c\u7167\u7740\u5b66\u5c31\u80fd\u4e0a\u624b \ud83d\udc47<br>\uff08\u6211\u4f1a\u7528<strong>\u901a\u4fd7\u89e3\u91ca + \u5b66\u4e60\u987a\u5e8f + \u793a\u4f8b<\/strong>\uff0c\u907f\u514d\u4e00\u4e0a\u6765\u5c31\u529d\u9000\uff09<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\ud83d\udc0d Python \u96f6\u57fa\u7840\u5165\u95e8\u6559\u7a0b\uff08\u4ece 0 \u5230\u80fd\u5199\u4ee3\u7801\uff09<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e00\u3001Python \u662f\u4ec0\u4e48\uff1f\u80fd\u5e72\u561b\uff1f<\/h2>\n\n\n\n<p>Python \u662f\u4e00\u95e8<strong>\u8bed\u6cd5\u7b80\u5355\u3001\u7528\u9014\u6781\u5e7f<\/strong>\u7684\u7f16\u7a0b\u8bed\u8a00\uff0c\u5e38\u89c1\u7528\u9014\u5305\u62ec\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ud83d\udd77 \u722c\u866b \/ \u81ea\u52a8\u5316\u811a\u672c<\/li>\n\n\n\n<li>\ud83d\udcca \u6570\u636e\u5206\u6790 \/ Excel \u81ea\u52a8\u5904\u7406<\/li>\n\n\n\n<li>\ud83e\udd16 \u4eba\u5de5\u667a\u80fd \/ \u673a\u5668\u5b66\u4e60<\/li>\n\n\n\n<li>\ud83c\udf10 Web \u7f51\u7ad9\u5f00\u53d1<\/li>\n\n\n\n<li>\ud83e\uddf0 \u8fd0\u7ef4 \/ \u6d4b\u8bd5 \/ \u6279\u91cf\u5de5\u5177<\/li>\n<\/ul>\n\n\n\n<p>\ud83d\udc49 \u96f6\u57fa\u7840\u3001\u975e\u8ba1\u7b97\u673a\u4e13\u4e1a\u4e5f\u5b8c\u5168\u80fd\u5b66\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\u3001\u51c6\u5907\u73af\u5883\uff085 \u5206\u949f\u641e\u5b9a\uff09<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u2705 \u63a8\u8350\u65b9\u5f0f\uff08\u6700\u7b80\u5355\uff09<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u76f4\u63a5\u4e0b\u8f7d\u5b89\u88c5 Python \u5b98\u7f51\u7248\u672c<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u5b98\u7f51\uff1a<a href=\"https:\/\/www.python.org\/\">https:\/\/www.python.org<\/a><\/li>\n\n\n\n<li>\u4e0b\u8f7d <strong>Python 3.x<\/strong><\/li>\n\n\n\n<li>\u5b89\u88c5\u65f6\u4e00\u5b9a\u52fe\u9009\uff1a<br>\u2714 <code>Add Python to PATH<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">\u2705 \u9a8c\u8bc1\u662f\u5426\u5b89\u88c5\u6210\u529f<\/h3>\n\n\n\n<p>\u6253\u5f00\u547d\u4ee4\u884c\uff08Windows\uff09\u6216\u7ec8\u7aef\uff08Mac\uff09\u8f93\u5165\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npython --version\n\n<\/pre><\/div>\n\n\n<p>\u770b\u5230\u7248\u672c\u53f7\u8bf4\u660e\u6210\u529f\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e09\u3001\u7b2c\u4e00\u4e2a Python \u7a0b\u5e8f\uff08Hello World\uff09<\/h2>\n\n\n\n<p>\u65b0\u5efa\u4e00\u4e2a\u6587\u4ef6\uff1a<code>hello.py<\/code><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nprint(&quot;Hello, Python!&quot;)\n\n<\/pre><\/div>\n\n\n<p>\u8fd0\u884c\u540e\u4f60\u5c31\u5df2\u7ecf\u8fc8\u5165\u7a0b\u5e8f\u5458\u4e16\u754c \ud83c\udf89<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u56db\u3001Python \u57fa\u7840\u5fc5\u5b66\u5185\u5bb9\uff08\u6838\u5fc3\uff09<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1\ufe0f\u20e3 \u53d8\u91cf\uff08\u88c5\u6570\u636e\u7684\u76d2\u5b50\uff09<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nname = &quot;Alice&quot;\nage = 18\nprint(name, age)\n\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li><code>=<\/code> \u4e0d\u662f\u7b49\u4e8e\uff0c\u662f<strong>\u8d4b\u503c<\/strong><\/li>\n\n\n\n<li>Python \u4e0d\u7528\u5199\u7c7b\u578b\uff0c\u81ea\u52a8\u8bc6\u522b<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">2\ufe0f\u20e3 \u57fa\u672c\u6570\u636e\u7c7b\u578b<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\na = 10        # \u6574\u6570 int\nb = 3.14      # \u5c0f\u6570 float\nc = &quot;hello&quot;   # \u5b57\u7b26\u4e32 str\nd = True      # \u5e03\u5c14\u503c bool\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">3\ufe0f\u20e3 \u8f93\u5165\u4e0e\u8f93\u51fa<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nname = input(&quot;\u8bf7\u8f93\u5165\u4f60\u7684\u540d\u5b57\uff1a&quot;)\nprint(&quot;\u4f60\u597d,&quot;, name)\n\n<\/pre><\/div>\n\n\n<p>\ud83d\udc49 \u5e38\u7528\u4e8e\u505a\u4ea4\u4e92\u5c0f\u7a0b\u5e8f<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">4\ufe0f\u20e3 \u6761\u4ef6\u5224\u65ad\uff08if\uff09<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nscore = 85\n\nif score &gt;= 60:\n    print(&quot;\u53ca\u683c&quot;)\nelse:\n    print(&quot;\u4e0d\u53ca\u683c&quot;)\n\n<\/pre><\/div>\n\n\n<p>\u26a0 \u6ce8\u610f\uff1aPython \u7528<strong>\u7f29\u8fdb<\/strong>\u8868\u793a\u4ee3\u7801\u5757<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">5\ufe0f\u20e3 \u5faa\u73af\uff08for \/ while\uff09<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">for \u5faa\u73af<\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfor i in range(5):\n    print(i)\n\n<\/pre><\/div>\n\n\n<p>\u8f93\u51fa\uff1a0 1 2 3 4<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">while \u5faa\u73af<\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ncount = 0\nwhile count &amp;lt; 3:\n    print(count)\n    count += 1\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">6\ufe0f\u20e3 \u5217\u8868\uff08\u6700\u5e38\u7528\uff09<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfruits = &#x5B;&quot;apple&quot;, &quot;banana&quot;, &quot;orange&quot;]\nprint(fruits&#x5B;0])     # apple\n\n<\/pre><\/div>\n\n\n<p>\u5e38\u7528\u64cd\u4f5c\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfruits.append(&quot;pear&quot;)\nlen(fruits)\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">7\ufe0f\u20e3 \u5b57\u5178\uff08\u952e\u503c\u5bf9\uff09<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nperson = {\n    &quot;name&quot;: &quot;Tom&quot;,\n    &quot;age&quot;: 20\n}\n\nprint(person&#x5B;&quot;name&quot;])\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">8\ufe0f\u20e3 \u51fd\u6570\uff08\u5c01\u88c5\u4ee3\u7801\uff09<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndef add(a, b):\n    return a + b\n\nprint(add(3, 5))\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e94\u3001\u96f6\u57fa\u7840\u5b66\u4e60\u987a\u5e8f\uff08\u7167\u7740\u6765\uff09<\/h2>\n\n\n\n<p>\ud83d\udcc5 <strong>7 \u5929\u5165\u95e8\u8def\u7ebf<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u5929\u6570<\/th><th>\u5b66\u4e60\u5185\u5bb9<\/th><\/tr><\/thead><tbody><tr><td>\u7b2c 1 \u5929<\/td><td>Python \u5b89\u88c5 + \u53d8\u91cf + print<\/td><\/tr><tr><td>\u7b2c 2 \u5929<\/td><td>\u6570\u636e\u7c7b\u578b + input<\/td><\/tr><tr><td>\u7b2c 3 \u5929<\/td><td>if \u5224\u65ad<\/td><\/tr><tr><td>\u7b2c 4 \u5929<\/td><td>for \/ while \u5faa\u73af<\/td><\/tr><tr><td>\u7b2c 5 \u5929<\/td><td>\u5217\u8868\u3001\u5b57\u5178<\/td><\/tr><tr><td>\u7b2c 6 \u5929<\/td><td>\u51fd\u6570<\/td><\/tr><tr><td>\u7b2c 7 \u5929<\/td><td>\u5199\u4e00\u4e2a\u5c0f\u9879\u76ee<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u516d\u3001\u9002\u5408\u65b0\u624b\u7684\u7ec3\u624b\u5c0f\u9879\u76ee<\/h2>\n\n\n\n<p>\u2714 \u731c\u6570\u5b57\u6e38\u620f<br>\u2714 \u6279\u91cf\u91cd\u547d\u540d\u6587\u4ef6<br>\u2714 \u81ea\u52a8\u7edf\u8ba1\u6210\u7ee9<br>\u2714 \u7b80\u5355\u722c\u866b\u6293\u7f51\u9875\u6807\u9898<br>\u2714 Excel \u81ea\u52a8\u5904\u7406\u5de5\u5177<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e03\u3001\u63a8\u8350\u96f6\u57fa\u7840\u5b66\u4e60\u8d44\u6e90<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udcd8 \u4e2d\u6587\u6559\u7a0b<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5ed6\u96ea\u5cf0 Python \u6559\u7a0b\uff08\u975e\u5e38\u9002\u5408\u65b0\u624b\uff09<\/li>\n\n\n\n<li>\u83dc\u9e1f\u6559\u7a0b Python<\/li>\n\n\n\n<li>CSDN Python \u4e13\u680f<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83c\udfa5 \u89c6\u9891<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>B \u7ad9\uff1a<code>Python \u96f6\u57fa\u7840\u5165\u95e8<\/code><\/li>\n\n\n\n<li>YouTube\uff1aPython for Beginners<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u516b\u3001\u5e38\u89c1\u65b0\u624b\u95ee\u9898<\/h2>\n\n\n\n<p>\u2753 \u5b66 Python \u8981\u5b66\u6570\u5b66\u5417\uff1f<br>\ud83d\udc49 \u5165\u95e8\u5b8c\u5168\u4e0d\u9700\u8981<\/p>\n\n\n\n<p>\u2753 \u591a\u4e45\u80fd\u5b66\u4f1a\uff1f<br>\ud83d\udc49 7 \u5929\u80fd\u5165\u95e8\uff0c1\u20132 \u4e2a\u6708\u80fd\u5199\u5b9e\u7528\u811a\u672c<\/p>\n\n\n\n<p>\u2753 Python \u80fd\u627e\u5de5\u4f5c\u5417\uff1f<br>\ud83d\udc49 \u53ef\u4ee5\uff0c\u4f46\u8981\u914d\u5408\u65b9\u5411\uff08\u722c\u866b \/ \u6570\u636e \/ AI\uff09<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e5d\u3001\u4e0b\u4e00\u6b65\u53ef\u4ee5\u5b66\u4ec0\u4e48\uff1f<\/h2>\n\n\n\n<p>\u5982\u679c\u4f60\u613f\u610f\uff0c\u6211\u53ef\u4ee5\u7ee7\u7eed\u5e26\u4f60\u5b66\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ud83d\udc0d Python \u81ea\u52a8\u5316\u529e\u516c<\/li>\n\n\n\n<li>\ud83d\udd77 Python \u722c\u866b\u5b9e\u6218<\/li>\n\n\n\n<li>\ud83d\udcca Python \u6570\u636e\u5206\u6790<\/li>\n\n\n\n<li>\ud83e\udd16 AI \/ NLP \u9879\u76ee\u5b9e\u6218<\/li>\n\n\n\n<li>\ud83e\udde0 \u96f6\u57fa\u7840 \u2192 \u9879\u76ee\u7ea7\u5b8c\u6574\u8def\u7ebf<\/li>\n<\/ul>\n\n\n\n<p>\u53ea\u8981\u544a\u8bc9\u6211\u4f60<strong>\u5b66 Python \u7684\u76ee\u7684<\/strong>\u5c31\u884c \ud83d\udc4d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0b\u9762\u7ed9\u4f60\u4e00\u5957\u771f\u6b63\u9002\u5408\u96f6\u57fa\u7840\u7684 Python \u5165\u95e8\u6559\u7a0b\u8def\u7ebf\uff0c\u4e0d\u9700\u8981\u4efb\u4f55\u7f16\u7a0b\u80cc\u666f\uff0c\u7167&#8230; <a class=\"more-link\" href=\"https:\/\/www.52runoob.com\/index.php\/2025\/12\/26\/python%e9%9b%b6%e5%9f%ba%e7%a1%80%e5%85%a5%e9%97%a8%e6%95%99%e7%a8%8b\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-973","post","type-post","status-publish","format-standard","hentry","category-1"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/973","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/comments?post=973"}],"version-history":[{"count":1,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/973\/revisions"}],"predecessor-version":[{"id":974,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/973\/revisions\/974"}],"wp:attachment":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/media?parent=973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/categories?post=973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/tags?post=973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}