{"id":108054,"date":"2026-09-20T21:49:11","date_gmt":"2026-09-20T13:49:11","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/108054.html"},"modified":"2026-09-20T21:49:11","modified_gmt":"2026-09-20T13:49:11","slug":"python%e5%9f%ba%e7%a1%8002-%e5%ad%97%e9%9d%a2%e9%87%8f%e3%80%81%e5%8f%98%e9%87%8f%e3%80%81%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%8b%e3%80%81%e8%be%93%e5%85%a5%e8%be%93%e5%87%ba%e4%b8%8e%e8%bf%90%e7%ae%97","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/108054.html","title":{"rendered":"Python\u57fa\u784002 \u5b57\u9762\u91cf\u3001\u53d8\u91cf\u3001\u6570\u636e\u7c7b\u578b\u3001\u8f93\u5165\u8f93\u51fa\u4e0e\u8fd0\u7b97\u7b26"},"content":{"rendered":"<p>\u6458\u8981&#xff1a;\u672c\u6587\u7cfb\u7edf\u8bb2\u89e3 Python \u7f16\u7a0b\u5165\u95e8\u7684\u57fa\u7840\u77e5\u8bc6&#xff0c;\u6db5\u76d6\u5b57\u9762\u91cf\u4e0e\u53d8\u91cf\u3001\u5e38\u89c1\u6570\u636e\u7c7b\u578b\u3001\u8f93\u5165\u8f93\u51fa\u4ee5\u53ca\u8fd0\u7b97\u7b26\u56db\u5927\u6838\u5fc3\u6a21\u5757\u3002\u5185\u5bb9\u4ece\u5b57\u9762\u91cf\u7684\u4e66\u5199\u683c\u5f0f\u3001\u53d8\u91cf\u7684\u5b9a\u4e49\u4e0e\u4f7f\u7528\u3001\u6807\u8bc6\u7b26\u7684\u547d\u540d\u89c4\u5219\u4e0e\u89c4\u8303&#xff0c;\u5230\u6574\u6570\u3001\u6d6e\u70b9\u6570\u3001\u5b57\u7b26\u4e32\u3001\u5e03\u5c14\u7b49\u57fa\u7840\u6570\u636e\u7c7b\u578b&#xff0c;\u518d\u5230 input() \u8f93\u5165\u3001print() \u8f93\u51fa\u4e0e\u7c7b\u578b\u8f6c\u6362&#xff0c;\u6700\u540e\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u7b97\u672f\u3001\u8d4b\u503c\u3001\u6bd4\u8f83\u548c\u903b\u8f91\u56db\u7c7b\u8fd0\u7b97\u7b26\u7684\u7528\u6cd5&#xff0c;\u5e76\u914d\u6709\u5927\u91cf\u53ef\u8fd0\u884c\u7684\u4ee3\u7801\u793a\u4f8b\u4e0e\u5b9e\u6218\u6848\u4f8b&#xff0c;\u5e2e\u52a9\u521d\u5b66\u8005\u5feb\u901f\u5efa\u7acb Python \u7f16\u7a0b\u7684\u57fa\u672c\u8ba4\u77e5\u3002<\/p>\n<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"-toc\" style=\"margin-left:0px\">\n<p id=\"%E4%B8%80%E3%80%81%E5%AD%97%E9%9D%A2%E9%87%8F%E4%B8%8E%E5%8F%98%E9%87%8F-toc\" style=\"margin-left:0px\">\u4e00\u3001\u5b57\u9762\u91cf\u4e0e\u53d8\u91cf<\/p>\n<p id=\"1.1%20%E5%AD%97%E9%9D%A2%E9%87%8F-toc\" style=\"margin-left:80px\">1.1 \u5b57\u9762\u91cf<\/p>\n<p id=\"1.2%20%E5%8F%98%E9%87%8F-toc\" style=\"margin-left:80px\">1.2 \u53d8\u91cf<\/p>\n<p id=\"1.3%20%E6%A0%87%E8%AF%86%E7%AC%A6-toc\" style=\"margin-left:80px\">1.3 \u6807\u8bc6\u7b26<\/p>\n<p id=\"1.4%20%E5%8F%98%E9%87%8F%E4%BA%A4%E6%8D%A2%E6%A1%88%E4%BE%8B-toc\" style=\"margin-left:80px\">1.4 \u53d8\u91cf\u4ea4\u6362\u6848\u4f8b<\/p>\n<p id=\"%E4%BA%8C%E3%80%81%E5%B8%B8%E8%A7%81%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B-toc\" style=\"margin-left:40px\">\u4e8c\u3001\u5e38\u89c1\u6570\u636e\u7c7b\u578b<\/p>\n<p id=\"2.1%20%E5%9F%BA%E7%A1%80%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B-toc\" style=\"margin-left:80px\">2.1 \u57fa\u7840\u6570\u636e\u7c7b\u578b<\/p>\n<p id=\"2.2%20%E6%9F%A5%E7%9C%8B%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B-toc\" style=\"margin-left:80px\">2.2 \u67e5\u770b\u6570\u636e\u7c7b\u578b<\/p>\n<p id=\"2.3%20%E5%AD%97%E7%AC%A6%E4%B8%B2-toc\" style=\"margin-left:80px\">2.3 \u5b57\u7b26\u4e32<\/p>\n<p id=\"2.4%20%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%8B%BC%E6%8E%A5-toc\" style=\"margin-left:80px\">2.4 \u5b57\u7b26\u4e32\u62fc\u63a5<\/p>\n<p id=\"2.5%20%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%A0%BC%E5%BC%8F%E5%8C%96-toc\" style=\"margin-left:80px\">2.5 \u5b57\u7b26\u4e32\u683c\u5f0f\u5316<\/p>\n<p id=\"2.5.1%20%E4%BD%BF%E7%94%A8%20%25%20%E5%8D%A0%E4%BD%8D%E7%AC%A6-toc\" style=\"margin-left:120px\">2.5.1 \u4f7f\u7528 % \u5360\u4f4d\u7b26<\/p>\n<p id=\"2.5.2%20%E4%BD%BF%E7%94%A8%20f-string%EF%BC%88%E6%8E%A8%E8%8D%90%EF%BC%89-toc\" style=\"margin-left:120px\">2.5.2 \u4f7f\u7528 f-string&#xff08;\u63a8\u8350&#xff09;<\/p>\n<p id=\"%E4%B8%89%E3%80%81%E8%BE%93%E5%85%A5%E4%B8%8E%E8%BE%93%E5%87%BA-toc\" style=\"margin-left:40px\">\u4e09\u3001\u8f93\u5165\u4e0e\u8f93\u51fa<\/p>\n<p id=\"3.1%20%E8%BE%93%E5%85%A5%20%E2%80%94%E2%80%94%20input()-toc\" style=\"margin-left:80px\">3.1 \u8f93\u5165 \u2014\u2014 input()<\/p>\n<p id=\"3.2%20%E8%BE%93%E5%87%BA%20%E2%80%94%E2%80%94%20print()-toc\" style=\"margin-left:80px\">3.2 \u8f93\u51fa \u2014\u2014 print()<\/p>\n<p id=\"3.3%20%E7%B1%BB%E5%9E%8B%E8%BD%AC%E6%8D%A2-toc\" style=\"margin-left:80px\">3.3 \u7c7b\u578b\u8f6c\u6362<\/p>\n<p id=\"%E5%9B%9B%E3%80%81%E8%BF%90%E7%AE%97%E7%AC%A6-toc\" style=\"margin-left:40px\">\u56db\u3001\u8fd0\u7b97\u7b26<\/p>\n<p id=\"4.1%20%E7%AE%97%E6%9C%AF%E8%BF%90%E7%AE%97%E7%AC%A6-toc\" style=\"margin-left:80px\">4.1 \u7b97\u672f\u8fd0\u7b97\u7b26<\/p>\n<p id=\"4.2%20%E8%B5%8B%E5%80%BC%E8%BF%90%E7%AE%97%E7%AC%A6-toc\" style=\"margin-left:80px\">4.2 \u8d4b\u503c\u8fd0\u7b97\u7b26<\/p>\n<p id=\"4.3%20%E6%AF%94%E8%BE%83%E8%BF%90%E7%AE%97%E7%AC%A6-toc\" style=\"margin-left:80px\">4.3 \u6bd4\u8f83\u8fd0\u7b97\u7b26<\/p>\n<p id=\"4.4%20%E9%80%BB%E8%BE%91%E8%BF%90%E7%AE%97%E7%AC%A6-toc\" style=\"margin-left:80px\">4.4 \u903b\u8f91\u8fd0\u7b97\u7b26<\/p>\n<hr id=\"hr-toc\" \/>\n<h2 id=\"%E4%B8%80%E3%80%81%E5%AD%97%E9%9D%A2%E9%87%8F%E4%B8%8E%E5%8F%98%E9%87%8F\">\u4e00\u3001\u5b57\u9762\u91cf\u4e0e\u53d8\u91cf<\/h2>\n<h4 id=\"1.1%20%E5%AD%97%E9%9D%A2%E9%87%8F\">1.1 \u5b57\u9762\u91cf<\/h4>\n<p>\u5b57\u9762\u91cf&#xff08;Literal&#xff09;&#xff1a;\u5728\u7a0b\u5e8f\u4e2d\u76f4\u63a5\u4e66\u5199\u51fa\u6765\u7684\u56fa\u5b9a\u503c&#xff08;\u6570\u636e&#xff09;\u3002<\/p>\n<p>\u5e38\u89c1\u5b57\u9762\u91cf\u7c7b\u578b\u53ca\u4e66\u5199\u683c\u5f0f&#xff1a;<\/p>\n<table>\n<tr>\u7c7b\u578b\u6807\u51c6\u540d\u79f0\u63cf\u8ff0\u793a\u4f8b<\/tr>\n<tbody>\n<tr>\n<td>\u6574\u6570<\/td>\n<td>int<\/td>\n<td>\u6570\u5b57\u7c7b\u578b&#xff0c;\u5b58\u653e\u6574\u6570<\/td>\n<td>10\u300118\u3001-5\u30010<\/td>\n<\/tr>\n<tr>\n<td>\u6d6e\u70b9\u6570<\/td>\n<td>float<\/td>\n<td>\u6570\u5b57\u7c7b\u578b&#xff0c;\u5b58\u653e\u5c0f\u6570<\/td>\n<td>8.5\u30013.14\u30011.0\u3001-3.5<\/td>\n<\/tr>\n<tr>\n<td>\u5e03\u5c14<\/td>\n<td>bool<\/td>\n<td>\u8868\u793a\u903b\u8f91\u4e0a\u7684\u771f\u6216\u5047<\/td>\n<td>True\u3001False<\/td>\n<\/tr>\n<tr>\n<td>\u5b57\u7b26\u4e32<\/td>\n<td>str<\/td>\n<td>\u63cf\u8ff0\u6587\u672c\u7684\u6570\u636e\u7c7b\u578b<\/td>\n<td>&#034;\u4eba\u751f\u82e6\u77ed&#xff0c;\u6211\u7528Python&#034;<\/td>\n<\/tr>\n<tr>\n<td>\u7a7a\u503c<\/td>\n<td>NoneType<\/td>\n<td>\u8868\u793a\u7a7a\u6216\u65e0\u503c&#xff0c;\u4ec5\u5305\u542b\u4e00\u4e2a\u503c None<\/td>\n<td>None<\/td>\n<\/tr>\n<tr>\n<td>\u6570\u636e\u5bb9\u5668<\/td>\n<td>list\/tuple\/set\/dict<\/td>\n<td>\u5b58\u50a8\u591a\u9879\u6570\u636e\u7684\u5bb9\u5668<\/td>\n<td>\u2014<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4ee3\u7801\u793a\u4f8b&#xff1a;<\/p>\n<p>print(100)            # \u6574\u6570&#xff08;int&#xff09;<br \/>\nprint(3.14)           # \u6d6e\u70b9\u6570&#xff08;float&#xff09;<br \/>\nprint(True)           # \u5e03\u5c14&#xff08;bool&#xff09;&#xff0c;\u9996\u5b57\u6bcd\u5fc5\u987b\u5927\u5199<br \/>\nprint(&#034;hello world&#034;)  # \u5b57\u7b26\u4e32&#xff08;str&#xff09;<br \/>\nprint(None)           # \u7a7a\u503c&#xff08;NoneType&#xff09;<br \/>\n\u5e03\u5c14\u7c7b\u578b\u7684\u672c\u8d28\u662f\u6574\u6570&#xff1a;True \u7b49\u4ef7\u4e8e 1&#xff0c;False \u7b49\u4ef7\u4e8e 0<br \/>\nprint(True &#043; 1)  # 2<br \/>\nprint(True &#8211; 1)  # 0 <\/p>\n<p>\u5173\u4e8e\u5e03\u5c14\u503c\u7684\u4e66\u5199&#xff1a;True\u3001False \u662f Python \u7684\u5173\u952e\u5b57&#xff0c;\u9996\u5b57\u6bcd\u5fc5\u987b\u5927\u5199\u3002\u5199\u6210\u5c0f\u5199\u7684 true\u3001false \u4f1a\u88ab\u5f53\u4f5c\u666e\u901a\u53d8\u91cf\u540d\u5904\u7406&#xff0c;\u76f4\u63a5\u4f7f\u7528\u4f1a\u62a5 NameError&#xff08;\u53d8\u91cf\u672a\u5b9a\u4e49\u9519\u8bef&#xff09;\u3002<\/p>\n<p>\u5c0f\u7ed3&#xff1a;<\/p>\n<li>\u5b57\u9762\u91cf\u662f\u7a0b\u5e8f\u4e2d\u76f4\u63a5\u4e66\u5199\u7684\u56fa\u5b9a\u503c\u3002<\/li>\n<li>\u5404\u7c7b\u578b\u4e66\u5199\u5f62\u5f0f&#xff1a;\u6574\u6570\u3001\u5c0f\u6570\u76f4\u63a5\u5199&#xff08;10\u30013.14&#xff09;&#xff1b;\u5b57\u7b26\u4e32\u7528\u5f15\u53f7\u5305\u88f9&#xff1b;\u5e03\u5c14\u503c\u5199 True \/ False&#xff1b;\u7a7a\u503c\u5199 None\u3002<\/li>\n<h4 id=\"1.2%20%E5%8F%98%E9%87%8F\">1.2 \u53d8\u91cf<\/h4>\n<p>\u53d8\u91cf&#xff1a;\u7a0b\u5e8f\u4e2d\u7528\u6765\u5b58\u50a8\u6570\u636e\u7684\u5bb9\u5668\u3002\u7ecf\u5e38\u53d8\u5316\u6216\u9700\u8981\u91cd\u590d\u4f7f\u7528\u7684\u6570\u636e&#xff0c;\u901a\u5e38\u5b58\u653e\u5728\u53d8\u91cf\u4e2d\u3002<\/p>\n<p>\u5b9a\u4e49\u683c\u5f0f&#xff1a;<\/p>\n<p>\u53d8\u91cf\u540d &#061; \u53d8\u91cf\u503c<\/p>\n<p>\u683c\u5f0f\u8bf4\u660e&#xff1a;<\/p>\n<ul>\n<li>\u53d8\u91cf\u540d&#xff1a;\u7ed9\u5b58\u50a8\u6570\u636e\u7684\u7a7a\u95f4\u8d77\u7684\u540d\u5b57<\/li>\n<li>&#061;&#xff1a;\u8d4b\u503c\u8fd0\u7b97\u7b26&#xff0c;\u628a\u7b49\u53f7\u53f3\u4fa7\u7684\u503c\u8d4b\u4e88\u5de6\u4fa7\u7684\u53d8\u91cf<\/li>\n<li>\u53d8\u91cf\u503c&#xff1a;\u53d8\u91cf\u4e2d\u5b58\u50a8\u7684\u5177\u4f53\u6570\u636e<\/li>\n<\/ul>\n<p>\u4ee3\u7801\u793a\u4f8b&#xff08;\u52a8\u6001\u7c7b\u578b&#xff09;&#xff1a;<\/p>\n<p># Python \u662f\u52a8\u6001\u7c7b\u578b\u8bed\u8a00&#xff1a;\u540c\u4e00\u4e2a\u53d8\u91cf\u53ef\u4ee5\u5148\u540e\u7ed1\u5b9a\u4e0d\u540c\u7c7b\u578b\u7684\u6570\u636e<br \/>\n# &#xff08;\u4f46\u9879\u76ee\u5f00\u53d1\u4e2d&#xff0c;\u63a8\u8350\u4e00\u4e2a\u53d8\u91cf\u53ea\u5b58\u50a8\u4e00\u79cd\u7c7b\u578b\u7684\u6570\u636e&#xff09;<br \/>\nnum &#061; 1114.1<br \/>\nprint(num)       # 1114.1<br \/>\nnum &#061; num &#043; 1    # \u7528\u53d8\u91cf\u7684\u65e7\u503c\u53c2\u4e0e\u8fd0\u7b97&#xff0c;\u518d\u628a\u7ed3\u679c\u8d4b\u56de\u53d8\u91cf<br \/>\nprint(num)       # 1115.1<br \/>\nnum &#061; &#039;ok&#039;       # \u53d8\u91cf\u91cd\u65b0\u7ed1\u5b9a\u5230\u5b57\u7b26\u4e32<br \/>\nprint(num)       # ok<br \/>\nnum &#061; True       # \u53d8\u91cf\u91cd\u65b0\u7ed1\u5b9a\u5230\u5e03\u5c14\u503c<br \/>\nprint(num)       # True <\/p>\n<p>\u4e3a\u4ec0\u4e48 print() \u8f93\u51fa\u7684\u662f\u503c&#xff0c;\u800c\u4e0d\u662f\u5185\u5b58\u5730\u5740&#xff1f; Python \u7684\u53d8\u91cf\u672c\u8d28\u662f&#034;\u540d\u5b57 \u2192 \u5bf9\u8c61&#034;\u7684\u7ed1\u5b9a\u5173\u7cfb&#xff0c;\u53d8\u91cf\u91cc\u4fdd\u5b58\u7684\u786e\u5b9e\u662f\u5bf9\u8c61\u7684\u5f15\u7528&#xff08;\u53ef\u7406\u89e3\u4e3a\u5730\u5740&#xff09;\u3002\u4f46 print() \u7684\u8bbe\u8ba1\u76ee\u6807\u5c31\u662f\u7ed9\u4eba\u770b\u7684&#xff0c;\u5b83\u4f1a\u81ea\u52a8\u628a\u5bf9\u8c61\u5f53\u524d\u7684\u5185\u5bb9\u8f6c\u6362\u6210\u53ef\u8bfb\u6587\u672c\u8f93\u51fa&#xff0c;\u6240\u4ee5\u770b\u5230\u7684\u662f&#034;\u503c&#034;\u800c\u4e0d\u662f\u5730\u5740\u2014\u2014\u8fd9\u4e0e C\u3001Java \u7b49\u8bed\u8a00\u6253\u5370\u5bf9\u8c61\u9ed8\u8ba4\u8f93\u51fa\u5730\u5740\u7684\u4e60\u60ef\u4e0d\u540c&#xff0c;\u662f Python \u6709\u610f\u7684\u8bbe\u8ba1\u3002\u5982\u679c\u786e\u5b9e\u60f3\u67e5\u770b\u5bf9\u8c61\u7684\u5185\u5b58\u5730\u5740&#xff0c;\u53ef\u4ee5\u4f7f\u7528\u5185\u7f6e\u51fd\u6570 id(\u53d8\u91cf)\u3002<\/p>\n<p>\u4e00\u6761\u8bed\u53e5\u5b9a\u4e49\u591a\u4e2a\u53d8\u91cf&#xff1a;\u5de6\u53f3\u4e24\u4fa7\u7528\u9017\u53f7\u5206\u9694&#xff0c;\u6309\u4f4d\u7f6e\u4e00\u4e00\u5bf9\u5e94\u8d4b\u503c&#xff1a;<\/p>\n<p>a, b &#061; 1, &#034;Python&#034;   # a &#061; 1&#xff0c;b &#061; &#034;Python&#034;<br \/>\nnumBase, incr &#061; 20.7, 50<\/p>\n<p>\u8f93\u51fa\u53d8\u91cf\u7684\u5e38\u7528\u65b9\u5f0f&#xff08;\u4ee5&#034;\u5b57\u7b26\u4e32 &#043; \u6570\u5b57&#034;\u6df7\u5408\u8f93\u51fa\u4e3a\u4f8b&#xff09;&#xff1a;<\/p>\n<p>numBase &#061; 20.7<br \/>\nincr &#061; 50<br \/>\n\u65b9\u5f0f\u4e00&#xff1a;print \u591a\u53c2\u6570\u8f93\u51fa&#xff0c;\u9017\u53f7\u5206\u9694&#xff0c;\u5404\u90e8\u5206\u4e4b\u95f4\u81ea\u52a8\u52a0\u4e00\u4e2a\u7a7a\u683c<br \/>\nprint(&#034;\u672a\u6765\u7b2c\u4e00\u4e2a\u6708\u7684\u64ad\u653e\u91cf:&#034;, numBase &#043; incr)<br \/>\n\u65b9\u5f0f\u4e8c&#xff1a;f-string \u683c\u5f0f\u5316&#xff08;\u63a8\u8350&#xff09;&#xff0c;\u53d8\u91cf\u76f4\u63a5\u5d4c\u5165\u5b57\u7b26\u4e32<br \/>\nprint(f&#034;\u672a\u6765\u7b2c\u4e00\u4e2a\u6708\u7684\u64ad\u653e\u91cf: {numBase &#043; incr}&#034;)<br \/>\n\u65b9\u5f0f\u4e09&#xff1a;\u5b57\u7b26\u4e32\u62fc\u63a5&#xff0c;\u975e\u5b57\u7b26\u4e32\u5fc5\u987b\u5148\u7528 str() \u8f6c\u6362<br \/>\nprint(&#034;\u672a\u6765\u7b2c\u4e00\u4e2a\u6708\u7684\u64ad\u653e\u91cf: &#034; &#043; str(numBase &#043; incr)) <\/p>\n<p>\u6848\u4f8b&#xff1a;B\u7ad9\u8bfe\u7a0b\u64ad\u653e\u91cf<\/p>\n<p>\u9700\u6c42&#xff1a;\u8bfe\u7a0b\u57fa\u7840\u64ad\u653e\u91cf\u4e3a 20.7 \u4e07&#xff0c;\u6bcf\u6708\u65b0\u589e\u64ad\u653e\u91cf 50 \u4e07&#xff0c;\u8f93\u51fa\u672a\u6765\u4e24\u4e2a\u6708\u6bcf\u4e2a\u6708\u7684\u64ad\u653e\u603b\u91cf\u3002<\/p>\n<p>base &#061; 20.7    # \u57fa\u7840\u64ad\u653e\u91cf&#xff08;\u4e07&#xff09;<br \/>\nadd &#061; 50       # \u6bcf\u6708\u65b0\u589e\u64ad\u653e\u91cf&#xff08;\u4e07&#xff09;<br \/>\nmonth1 &#061; base &#043; add        # \u7b2c\u4e00\u4e2a\u6708&#xff1a;\u57fa\u7840 &#043; \u65b0\u589e<br \/>\nmonth2 &#061; month1 &#043; add      # \u7b2c\u4e8c\u4e2a\u6708&#xff1a;\u7b2c\u4e00\u4e2a\u6708 &#043; \u65b0\u589e<br \/>\nprint(f&#034;\u7b2c\u4e00\u4e2a\u6708\u64ad\u653e\u603b\u91cf&#xff1a;{month1}\u4e07&#034;)   # \u7b2c\u4e00\u4e2a\u6708\u64ad\u653e\u603b\u91cf&#xff1a;70.7\u4e07<br \/>\nprint(f&#034;\u7b2c\u4e8c\u4e2a\u6708\u64ad\u653e\u603b\u91cf&#xff1a;{month2}\u4e07&#034;)   # \u7b2c\u4e8c\u4e2a\u6708\u64ad\u653e\u603b\u91cf&#xff1a;120.7\u4e07 <\/p>\n<p>\u5c0f\u7ed3&#xff1a;<\/p>\n<li>\u53d8\u91cf\u662f\u5b58\u50a8\u6570\u636e\u7684\u5bb9\u5668&#xff0c;\u5b9a\u4e49\u683c\u5f0f&#xff1a;\u53d8\u91cf\u540d &#061; \u53d8\u91cf\u503c\u3002<\/li>\n<li>\u53d8\u91cf\u7684\u7528\u9014&#xff1a;\u8f93\u51fa\u6253\u5370\u3001\u53c2\u4e0e\u8ba1\u7b97\u3001\u8bb0\u5f55\u6570\u636e\u3002<\/li>\n<li>\u6ce8\u610f\u4e8b\u9879&#xff1a;\n<ul>\n<li>\u4e00\u4e2a\u53d8\u91cf\u540c\u4e00\u65f6\u523b\u53ea\u5b58\u50a8\u4e00\u4e2a\u503c&#xff0c;\u91cd\u590d\u8d4b\u503c\u4f1a\u8986\u76d6\u65e7\u503c<\/li>\n<li>\u53d8\u91cf\u5fc5\u987b\u5148\u8d4b\u503c&#xff08;\u5b9a\u4e49&#xff09;\u624d\u80fd\u4f7f\u7528<\/li>\n<li>\u4e00\u6761\u8bed\u53e5\u53ef\u4ee5\u5b9a\u4e49\u591a\u4e2a\u53d8\u91cf&#xff1a;a, b &#061; 1, &#034;Python&#034;<\/li>\n<\/ul>\n<\/li>\n<h4 id=\"1.3%20%E6%A0%87%E8%AF%86%E7%AC%A6\">1.3 \u6807\u8bc6\u7b26<\/h4>\n<p>\u6807\u8bc6\u7b26&#xff1a;\u7a0b\u5e8f\u5458\u5728\u4ee3\u7801\u4e2d\u4e3a\u53d8\u91cf\u3001\u51fd\u6570\u3001\u7c7b\u7b49\u5143\u7d20\u6240\u8d77\u7684\u540d\u5b57\u3002<\/p>\n<p>\u547d\u540d\u89c4\u5219&#xff08;\u5f3a\u5236\u89c4\u5b9a&#xff0c;\u8fdd\u53cd\u4f1a\u62a5\u9519&#xff09;&#xff1a;<\/p>\n<li>\u53ea\u80fd\u5305\u542b\u5b57\u6bcd&#xff08;a-z\u3001A-Z&#xff09;\u3001\u6570\u5b57&#xff08;0-9&#xff09;\u3001\u4e0b\u5212\u7ebf&#xff08;_&#xff09;<\/li>\n<li>\u4e0d\u80fd\u4ee5\u6570\u5b57\u5f00\u5934<\/li>\n<li>\u4e0d\u80fd\u4f7f\u7528 Python \u5173\u952e\u5b57&#xff1a;True\u3001False\u3001None\u3001and\u3001or\u3001if\u3001else\u3001elif\u3001for\u3001while \u7b49<\/li>\n<li>\u4e25\u683c\u533a\u5206\u5927\u5c0f\u5199&#xff1a;age\u3001Age\u3001AGE \u662f\u4e09\u4e2a\u4e0d\u540c\u7684\u6807\u8bc6\u7b26<\/li>\n<p>\u5408\u6cd5\u4e0e\u4e0d\u5408\u6cd5\u6807\u8bc6\u7b26\u793a\u4f8b&#xff1a;<\/p>\n<table>\n<tr>\u6807\u8bc6\u7b26\u662f\u5426\u5408\u6cd5\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>name<\/td>\n<td>\u2705<\/td>\n<td>\u5408\u6cd5<\/td>\n<\/tr>\n<tr>\n<td>Name<\/td>\n<td>\u2705<\/td>\n<td>\u5408\u6cd5&#xff08;\u533a\u5206\u5927\u5c0f\u5199&#xff0c;\u4e0e name \u4e0d\u540c&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>_name<\/td>\n<td>\u2705<\/td>\n<td>\u5408\u6cd5<\/td>\n<\/tr>\n<tr>\n<td>__name<\/td>\n<td>\u2705<\/td>\n<td>\u5408\u6cd5<\/td>\n<\/tr>\n<tr>\n<td>na_me<\/td>\n<td>\u2705<\/td>\n<td>\u5408\u6cd5<\/td>\n<\/tr>\n<tr>\n<td>name_<\/td>\n<td>\u2705<\/td>\n<td>\u5408\u6cd5<\/td>\n<\/tr>\n<tr>\n<td>na$me<\/td>\n<td>\u274c<\/td>\n<td>\u5305\u542b\u975e\u6cd5\u5b57\u7b26 $<\/td>\n<\/tr>\n<tr>\n<td>and<\/td>\n<td>\u274c<\/td>\n<td>\u5173\u952e\u5b57<\/td>\n<\/tr>\n<tr>\n<td>or<\/td>\n<td>\u274c<\/td>\n<td>\u5173\u952e\u5b57<\/td>\n<\/tr>\n<tr>\n<td>true<\/td>\n<td>\u2705<\/td>\n<td>\u5408\u6cd5\u6807\u8bc6\u7b26&#xff08;\u5c0f\u5199 true \u4e0d\u662f\u5173\u952e\u5b57&#xff0c;\u53ef\u4ee5\u8fd0\u884c&#xff09;&#xff0c;\u4f46\u5bb9\u6613\u4e0e\u5e03\u5c14\u503c True \u6df7\u6dc6&#xff0c;\u4e0d\u5efa\u8bae\u4f7f\u7528<\/td>\n<\/tr>\n<tr>\n<td>False<\/td>\n<td>\u274c<\/td>\n<td>\u5173\u952e\u5b57<\/td>\n<\/tr>\n<tr>\n<td>6name<\/td>\n<td>\u274c<\/td>\n<td>\u6570\u5b57\u5f00\u5934<\/td>\n<\/tr>\n<tr>\n<td>name6<\/td>\n<td>\u2705<\/td>\n<td>\u5408\u6cd5<\/td>\n<\/tr>\n<tr>\n<td>naME<\/td>\n<td>\u2705<\/td>\n<td>\u5408\u6cd5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u547d\u540d\u89c4\u8303&#xff08;\u5efa\u8bae&#xff0c;\u4e0d\u9075\u5b88\u4e0d\u4f1a\u62a5\u9519&#xff09;&#xff1a;<\/p>\n<li>\u89c1\u540d\u77e5\u610f<\/li>\n<li>\u591a\u4e2a\u5355\u8bcd\u7528\u4e0b\u5212\u7ebf\u8fde\u63a5&#xff08;\u86c7\u5f62\u547d\u540d\u6cd5&#xff09;<\/li>\n<li>\u82f1\u6587\u5b57\u6bcd\u5168\u90e8\u5c0f\u5199<\/li>\n<p>PEP 8&#xff1a;PEP&#xff08;Python Enhancement Proposal&#xff0c;Python \u589e\u5f3a\u63d0\u6848&#xff09;\u662f Python \u793e\u533a\u7684\u6838\u5fc3\u6280\u672f\u6587\u6863\u4e0e\u6807\u51c6\u5316\u673a\u5236&#xff1b;PEP 8 \u662f\u5176\u4e2d\u9488\u5bf9\u4ee3\u7801\u98ce\u683c\u7684\u6307\u5357&#xff08;https:\/\/peps.python.org\/pep-0008&#xff09;\u3002<\/p>\n<p>\u547d\u540d\u89c4\u8303\u793a\u4f8b&#xff1a;<\/p>\n<table>\n<tr>\u53d8\u91cf\u540d\u8bc4\u4ef7<\/tr>\n<tbody>\n<tr>\n<td>name<\/td>\n<td>\u2705 \u7b26\u5408\u89c4\u8303<\/td>\n<\/tr>\n<tr>\n<td>age<\/td>\n<td>\u2705 \u7b26\u5408\u89c4\u8303<\/td>\n<\/tr>\n<tr>\n<td>update_time<\/td>\n<td>\u2705 \u7b26\u5408\u89c4\u8303<\/td>\n<\/tr>\n<tr>\n<td>my_name<\/td>\n<td>\u2705 \u7b26\u5408\u89c4\u8303<\/td>\n<\/tr>\n<tr>\n<td>user_first_name<\/td>\n<td>\u2705 \u7b26\u5408\u89c4\u8303<\/td>\n<\/tr>\n<tr>\n<td>a<\/td>\n<td>\u26a0\ufe0f \u4e0d\u63a8\u8350&#xff08;\u610f\u4e49\u4e0d\u660e\u786e&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>a1\u3001a2<\/td>\n<td>\u26a0\ufe0f \u4e0d\u63a8\u8350&#xff08;\u610f\u4e49\u4e0d\u660e\u786e&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>updatetime<\/td>\n<td>\u26a0\ufe0f \u4e0d\u63a8\u8350&#xff08;\u672a\u7528\u4e0b\u5212\u7ebf\u5206\u9694&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>myname<\/td>\n<td>\u26a0\ufe0f \u4e0d\u63a8\u8350&#xff08;\u672a\u7528\u4e0b\u5212\u7ebf\u5206\u9694&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5c0f\u7ed3&#xff1a;<\/p>\n<li>\u547d\u540d\u89c4\u5219&#xff1a;\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u4e0b\u5212\u7ebf&#xff1b;\u6570\u5b57\u4e0d\u80fd\u5f00\u5934&#xff1b;\u4e0d\u80fd\u4f7f\u7528\u5173\u952e\u5b57&#xff1b;\u4e25\u683c\u533a\u5206\u5927\u5c0f\u5199\u3002<\/li>\n<li>\u547d\u540d\u89c4\u8303&#xff1a;\u89c1\u540d\u77e5\u610f&#xff1b;\u591a\u4e2a\u5355\u8bcd\u7528\u4e0b\u5212\u7ebf\u8fde\u63a5&#xff1b;\u5168\u90e8\u5c0f\u5199\u3002<\/li>\n<h4 id=\"1.4%20%E5%8F%98%E9%87%8F%E4%BA%A4%E6%8D%A2%E6%A1%88%E4%BE%8B\">1.4 \u53d8\u91cf\u4ea4\u6362\u6848\u4f8b<\/h4>\n<p>\u6848\u4f8b1&#xff1a;\u4e24\u4e2a\u53d8\u91cf a &#061; 10\u3001b &#061; 20&#xff0c;\u4ea4\u6362\u5b83\u4eec\u7684\u503c\u5e76\u8f93\u51fa\u3002<\/p>\n<p>a &#061; 10<br \/>\nb &#061; 20<br \/>\n\u65b9\u6cd5\u4e00&#xff1a;\u501f\u52a9\u4e34\u65f6\u53d8\u91cf&#xff08;\u901a\u7528\u5199\u6cd5&#xff0c;\u4efb\u4f55\u8bed\u8a00\u90fd\u9002\u7528&#xff09;<br \/>\ntemp &#061; a     # \u5148\u628a a \u7684\u503c 10 \u4fdd\u5b58\u5230 temp<br \/>\na &#061; b        # \u628a b \u7684\u503c 20 \u8d4b\u7ed9 a<br \/>\nb &#061; temp     # \u628a temp \u4e2d\u4fdd\u5b58\u7684 10 \u8d4b\u7ed9 b<br \/>\n\u65b9\u6cd5\u4e8c&#xff1a;Python \u7279\u6709\u7684\u591a\u5143\u8d4b\u503c&#xff08;\u63a8\u8350&#xff09;<br \/>\na, b &#061; b, a  # \u7b49\u53f7\u53f3\u8fb9\u5148\u6574\u4f53\u6c42\u503c&#xff0c;\u518d\u6309\u4f4d\u7f6e\u4f9d\u6b21\u8d4b\u7ed9\u5de6\u8fb9<br \/>\nprint(f&#034;a &#061; {a}, b &#061; {b}&#034;)   # a &#061; 20, b &#061; 10 <\/p>\n<p>\u9519\u8bef\u5199\u6cd5&#xff1a;<\/p>\n<p>a &#061; b   # a \u53d8\u4e3a 20&#xff0c;\u539f\u6765\u7684 10 \u4e22\u5931<br \/>\nb &#061; a   # b \u4ecd\u4e3a 20&#xff0c;\u4ea4\u6362\u5931\u8d25<\/p>\n<p>\u6848\u4f8b2&#xff1a;\u4e09\u4e2a\u53d8\u91cf a &#061; 100\u3001b &#061; 200\u3001c &#061; 300&#xff0c;\u5c06 a, b, c \u7684\u503c\u5206\u522b\u8d4b\u7ed9 c, a, b&#xff0c;\u5e76\u8f93\u51fa\u3002<\/p>\n<p>a, b, c &#061; 100, 200, 300<br \/>\na, b, c &#061; c, a, b   # \u7b49\u53f7\u53f3\u8fb9\u5148\u6c42\u51fa (300, 100, 200)&#xff0c;\u518d\u4f9d\u6b21\u8d4b\u503c<br \/>\nprint(f&#034;a &#061; {a}, b &#061; {b}, c &#061; {c}&#034;)   # a &#061; 300, b &#061; 100, c &#061; 200 <\/p>\n<h3 id=\"%E4%BA%8C%E3%80%81%E5%B8%B8%E8%A7%81%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B\">\u4e8c\u3001\u5e38\u89c1\u6570\u636e\u7c7b\u578b<\/h3>\n<h4 id=\"2.1%20%E5%9F%BA%E7%A1%80%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B\">2.1 \u57fa\u7840\u6570\u636e\u7c7b\u578b<\/h4>\n<table>\n<tr>\u6807\u51c6\u540d\u79f0\u63cf\u8ff0\u8bf4\u660e\u793a\u4f8b<\/tr>\n<tbody>\n<tr>\n<td>int<\/td>\n<td>\u6574\u6570<\/td>\n<td>\u6570\u5b57\u7c7b\u578b&#xff0c;\u5b58\u653e\u6574\u6570<\/td>\n<td>10\u3001-5<\/td>\n<\/tr>\n<tr>\n<td>float<\/td>\n<td>\u6d6e\u70b9\u6570<\/td>\n<td>\u6570\u5b57\u7c7b\u578b&#xff0c;\u5b58\u653e\u5c0f\u6570<\/td>\n<td>8.5\u30013.14\u30011.0\u3001-3.5<\/td>\n<\/tr>\n<tr>\n<td>str<\/td>\n<td>\u5b57\u7b26\u4e32<\/td>\n<td>\u7528\u5f15\u53f7\u5305\u88f9\u7684\u6587\u672c<\/td>\n<td>&#034;Python&#034;<\/td>\n<\/tr>\n<tr>\n<td>bool<\/td>\n<td>\u5e03\u5c14<\/td>\n<td>\u63cf\u8ff0\u771f\u548c\u5047<\/td>\n<td>True\u3001False<\/td>\n<\/tr>\n<tr>\n<td>NoneType<\/td>\n<td>\u7a7a\u503c<\/td>\n<td>\u8868\u793a\u7a7a\u6216\u65e0\u503c&#xff0c;\u4ec5\u5305\u542b\u4e00\u4e2a\u503c None<\/td>\n<td>None<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4 id=\"2.2%20%E6%9F%A5%E7%9C%8B%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B\">2.2 \u67e5\u770b\u6570\u636e\u7c7b\u578b<\/h4>\n<p>\u65b9\u6cd5\u4e00&#xff1a;type() \u2014\u2014 \u76f4\u63a5\u8fd4\u56de\u6570\u636e\u7684\u7c7b\u578b\u3002<\/p>\n<p>type(\u8981\u67e5\u770b\u7c7b\u578b\u7684\u6570\u636e)<\/p>\n<p>print(type(&#034;Hello&#034;))    # &lt;class &#039;str&#039;&gt;<br \/>\nprint(type(10))         # &lt;class &#039;int&#039;&gt;<br \/>\nprint(type(3.14))       # &lt;class &#039;float&#039;&gt;<br \/>\nprint(type(True))       # &lt;class &#039;bool&#039;&gt;<br \/>\nprint(type(None))       # &lt;class &#039;NoneType&#039;&gt;<br \/>\nnum &#061; 5.0<br \/>\nprint(num)              # 5.0&#xff08;\u867d\u7136\u6570\u503c\u4e0a\u662f\u6574\u6570&#xff0c;\u4f46\u5e26\u5c0f\u6570\u70b9&#xff09;<br \/>\nprint(type(num))        # &lt;class &#039;float&#039;&gt;<br \/>\n\u5e03\u5c14\u503c\u53c2\u4e0e\u7b97\u672f\u8fd0\u7b97\u65f6\u6309\u6574\u6570\u5904\u7406&#xff1a;True \u662f 1&#xff0c;False \u662f 0<br \/>\nprint(type(True &#043; 1))   # &lt;class &#039;int&#039;&gt; <\/p>\n<p>\u65b9\u6cd5\u4e8c&#xff1a;isinstance() \u2014\u2014 \u5224\u65ad\u6570\u636e\u662f\u5426\u5c5e\u4e8e\u6307\u5b9a\u7c7b\u578b&#xff0c;\u8fd4\u56de\u5e03\u5c14\u503c&#xff08;True \/ False&#xff09;\u3002<\/p>\n<p>isinstance(\u6570\u636e, \u7c7b\u578b)<\/p>\n<p>num &#061; 5.0<br \/>\nprint(isinstance(num, int))    # False<br \/>\nprint(isinstance(num, float))  # True<br \/>\nnum2 &#061; -100<br \/>\nprint(isinstance(num2, int))   # True<br \/>\nprint(isinstance(num2, float)) # False<br \/>\nprint(isinstance(num2, bool))  # False <\/p>\n<p>isinstance() \u7684\u7528\u9014&#xff1a;\u5f53\u9700\u8981&#034;\u6839\u636e\u6570\u636e\u7684\u7c7b\u578b\u51b3\u5b9a\u4e0b\u4e00\u6b65\u505a\u4ec0\u4e48&#034;\u65f6\u4f7f\u7528&#xff0c;\u5178\u578b\u573a\u666f\u662f\u6821\u9a8c\u6570\u636e\u7684\u7c7b\u578b\u662f\u5426\u5408\u6cd5&#xff08;\u4f8b\u5982\u6821\u9a8c\u51fd\u6570\u53c2\u6570\u3001\u5904\u7406\u5916\u90e8\u4f20\u5165\u7684\u6570\u636e&#xff09;&#xff1a;<\/p>\n<p>print(isinstance(100, int))             # True<br \/>\nprint(isinstance(&#034;abc&#034;, str))           # True<br \/>\nprint(isinstance(3.14, (int, float)))   # True&#xff1a;\u7b2c\u4e8c\u4e2a\u53c2\u6570\u4e5f\u53ef\u4ee5\u662f\u7c7b\u578b\u5143\u7ec4&#xff0c;\u5339\u914d\u5176\u4e2d\u4efb\u610f\u4e00\u4e2a\u5373\u6210\u7acb<\/p>\n<p>type() \u4e0e isinstance() \u7684\u533a\u522b&#xff1a;type() \u8fd4\u56de\u6570\u636e\u7684\u51c6\u786e\u7c7b\u578b&#xff1b;isinstance() \u8fd4\u56de&#034;\u662f\/\u5426&#034;\u7684\u5224\u65ad\u7ed3\u679c&#xff0c;\u5e76\u4e14\u652f\u6301\u5224\u65ad&#034;\u662f\u5426\u5c5e\u4e8e\u67d0\u4e2a\u7c7b\u578b&#xff08;\u6216\u5176\u5b50\u7c7b&#xff09;&#034;&#xff0c;\u5b9e\u9645\u5f00\u53d1\u4e2d\u66f4\u5e38\u7528\u3002<\/p>\n<p>\u8bf4\u660e&#xff1a;\u53d8\u91cf\u672c\u8eab\u6ca1\u6709\u7c7b\u578b&#xff0c;type(\u53d8\u91cf) \u5f97\u5230\u7684\u662f\u53d8\u91cf\u5f53\u524d\u6240\u5b58\u50a8\u6570\u636e\u7684\u7c7b\u578b\u3002<\/p>\n<h4 id=\"2.3%20%E5%AD%97%E7%AC%A6%E4%B8%B2\">2.3 \u5b57\u7b26\u4e32<\/h4>\n<p>\u5b57\u7b26&#xff1a;\u6587\u672c\u4e16\u754c\u7684\u57fa\u672c\u5355\u4f4d&#xff0c;\u4e00\u4e2a\u5b57\u6bcd\u3001\u4e00\u4e2a\u6570\u5b57\u3001\u4e00\u4e2a\u6807\u70b9\u7b26\u53f7\u3001\u4e00\u4e2a\u6c49\u5b57\u90fd\u662f\u4e00\u4e2a\u5b57\u7b26\u3002\u5b57\u7b26\u4e32&#xff1a;\u7531\u82e5\u5e72\u5b57\u7b26\u7ec4\u6210\u7684\u5e8f\u5217&#xff0c;\u7528\u5f15\u53f7\u5305\u88f9\u3002<\/p>\n<p>\u4e09\u79cd\u5b9a\u4e49\u65b9\u5f0f&#xff1a;<\/p>\n<p># 1. \u53cc\u5f15\u53f7\u5b9a\u4e49<br \/>\ns1 &#061; &#034;Hello&#034;<br \/>\n2. \u5355\u5f15\u53f7\u5b9a\u4e49&#xff1a;\u5b57\u7b26\u4e32\u672c\u8eab\u542b\u6709\u5355\u5f15\u53f7\u65f6&#xff0c;\u53ef\u7528 \\\\ \u8f6c\u4e49&#xff1b;<br \/>\n\u66f4\u7b80\u6d01\u7684\u505a\u6cd5\u662f\u5916\u5c42\u76f4\u63a5\u7528\u53cc\u5f15\u53f7&#xff08;\u5185\u5916\u5f15\u53f7\u8981\u4e00\u4e00\u914d\u5bf9&#xff0c;\u4e0d\u80fd\u4ea4\u53c9&#xff09;<br \/>\ns2 &#061; &#039;It&#039;s very interesting&#039;<br \/>\ns2 &#061; &#034;It&#039;s very interesting&#034;   # \u63a8\u8350\u5199\u6cd5<br \/>\n3. \u4e09\u5f15\u53f7\u5b9a\u4e49&#xff1a;\u652f\u6301\u591a\u884c\u6587\u672c&#xff08;\u524d\u4e24\u79cd\u65b9\u5f0f\u505a\u4e0d\u5230&#xff09;<br \/>\ns3 &#061; &#034;&#034;&#034;<br \/>\n\u5c0a\u656c\u7684\u5ba2\u6237&#xff1a;<br \/>\n\u611f\u8c22\u60a8\u9009\u62e9\u6211\u4eec\u516c\u53f8\u7684\u4ea7\u54c1\u3002<br \/>\n\u6211\u4eec\u5c06\u4e3a\u60a8\u7aed\u8bda\u670d\u52a1\u3002<br \/>\n\u795d\u597d&#xff5e;<br \/>\n&#034;&#034;&#034; <\/p>\n<p>\u5e38\u89c1\u8f6c\u4e49\u5b57\u7b26&#xff1a;<\/p>\n<table>\n<tr>\u8f6c\u4e49\u5b57\u7b26\u540d\u79f0\u4f5c\u7528<\/tr>\n<tbody>\n<tr>\n<td>\\\\&#039;<\/td>\n<td>\u5355\u5f15\u53f7<\/td>\n<td>\u5728\u5355\u5f15\u53f7\u5b57\u7b26\u4e32\u4e2d\u8868\u793a\u5355\u5f15\u53f7\u672c\u8eab<\/td>\n<\/tr>\n<tr>\n<td>\\\\&#034;<\/td>\n<td>\u53cc\u5f15\u53f7<\/td>\n<td>\u5728\u53cc\u5f15\u53f7\u5b57\u7b26\u4e32\u4e2d\u8868\u793a\u53cc\u5f15\u53f7\u672c\u8eab<\/td>\n<\/tr>\n<tr>\n<td>\\\\n<\/td>\n<td>\u6362\u884c\u7b26<\/td>\n<td>\u5f00\u59cb\u65b0\u7684\u4e00\u884c<\/td>\n<\/tr>\n<tr>\n<td>\\\\t<\/td>\n<td>\u5236\u8868\u7b26<\/td>\n<td>\u7f29\u8fdb\u4e00\u4e2a Tab \u7684\u5bbd\u5ea6<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8f6c\u4e49\u5b57\u7b26\u793a\u4f8b&#xff1a;<\/p>\n<p>print(&#039;It\\\\&#039;s OK&#039;)       # It&#039;s OK&#xff08;\u8f6c\u4e49\u5355\u5f15\u53f7&#xff09;<br \/>\nprint(&#034;say \\\\&#034;hi\\\\&#034;&#034;)     # say &#034;hi&#034;&#xff08;\u8f6c\u4e49\u53cc\u5f15\u53f7&#xff09;<br \/>\nprint(&#034;\u7b2c\u4e00\u884c\\\\n\u7b2c\u4e8c\u884c&#034;)   # \u5206\u4e24\u884c\u8f93\u51fa<br \/>\nprint(&#034;\u59d3\u540d:\\\\tTom&#034;)      # \u5192\u53f7\u540e\u9694\u4e00\u4e2a Tab \u518d\u8f93\u51fa Tom<\/p>\n<p>\u5c0f\u7ed3&#xff1a;<\/p>\n<li>\u5b57\u7b26\u4e32\u7684\u4e09\u79cd\u5b9a\u4e49\u65b9\u5f0f&#xff1a;\u5355\u5f15\u53f7&#xff08;&#039;Python&#039;&#xff09;\u3001\u53cc\u5f15\u53f7&#xff08;&#034;Python&#034;&#xff09;\u3001\u4e09\u5f15\u53f7&#xff08;&#034;&#034;&#034;Python&#034;&#034;&#034;&#xff09;\u3002<\/li>\n<li>\u5e38\u89c1\u8f6c\u4e49\u5b57\u7b26&#xff1a;\\\\&#039;\u3001\\\\&#034;\u3001\\\\n\u3001\\\\t\u3002<\/li>\n<li>\u4f7f\u7528\u539f\u5219&#xff1a;\n<ul>\n<li>\u5355\u5f15\u53f7\u4e0e\u53cc\u5f15\u53f7\u5b8c\u5168\u7b49\u6548&#xff0c;\u9879\u76ee\u4e2d\u4fdd\u6301\u4e00\u79cd\u5199\u6cd5\u5373\u53ef<\/li>\n<li>\u4e09\u5f15\u53f7\u9002\u5408\u591a\u884c\u6587\u672c\u7b49\u573a\u666f<\/li>\n<\/ul>\n<\/li>\n<h4 id=\"2.4%20%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%8B%BC%E6%8E%A5\">2.4 \u5b57\u7b26\u4e32\u62fc\u63a5<\/h4>\n<p>\u5f88\u591a\u65f6\u5019\u9700\u8981\u628a\u591a\u4e2a\u5b57\u7b26\u4e32\u62fc\u63a5\u8d77\u6765&#xff0c;\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 &#043;\u3002<\/p>\n<p># \u5199\u6cd5\u4e00&#xff1a;\u76f8\u90bb\u7684\u5b57\u7b26\u4e32\u5b57\u9762\u91cf\u4f1a\u81ea\u52a8\u62fc\u63a5&#xff08;\u4ec5\u9002\u7528\u4e8e\u5b57\u9762\u91cf&#xff0c;\u4e2d\u95f4\u4e0d\u80fd\u653e\u53d8\u91cf&#xff09;<br \/>\nslogan &#061; &#034;\u4eba\u751f\u82e6\u77ed &#034; &#034;,&#034; &#034;\u55b5\u800c\u54aa\u4e4b&#034;<br \/>\nprint(slogan)                       # \u4eba\u751f\u82e6\u77ed ,\u55b5\u800c\u54aa\u4e4b<br \/>\n\u5199\u6cd5\u4e8c&#xff1a;\u4f7f\u7528 &#043; \u53f7\u62fc\u63a5&#xff08;\u5b57\u9762\u91cf\u3001\u53d8\u91cf\u90fd\u53ef\u4ee5&#xff09;<br \/>\nslogan &#061; &#034;\u4eba\u751f\u82e6\u77ed &#034; &#043; &#034;,&#034; &#043; &#034;\u55b5\u800c\u54aa\u4e4b&#034;<br \/>\nprint(slogan)<br \/>\ns1 &#061; &#034;\u4eba\u751f\u82e6\u77ed&#034;<br \/>\ns2 &#061; &#034;\u6211\u7528Python&#034;<br \/>\nprint(&#034;\u5409\u591a\u00b7\u8303\u7f57\u82cf\u59c6&#xff1a;&#034; &#043; s1 &#043; &#034;&#xff0c;&#034; &#043; s2) <\/p>\n<p>\u6ce8\u610f&#xff1a;&#043; \u53ea\u80fd\u62fc\u63a5\u5b57\u7b26\u4e32\u4e0e\u5b57\u7b26\u4e32&#xff0c;\u65e0\u6cd5\u76f4\u63a5\u62fc\u63a5\u975e\u5b57\u7b26\u4e32\u7c7b\u578b&#xff0c;\u975e\u5b57\u7b26\u4e32\u5fc5\u987b\u5148\u7528 str() \u8f6c\u6362\u6210\u5b57\u7b26\u4e32\u3002<\/p>\n<p>\u6848\u4f8b&#xff1a;\u8f93\u51fa\u4e2a\u4eba\u4fe1\u606f<\/p>\n<p>\u9700\u6c42&#xff1a;\u8f93\u51fa&#034;\u5927\u5bb6\u597d&#xff0c;\u6211\u662flily&#xff0c;\u4eca\u5e7418\u5c81&#xff0c;\u5b66\u4e60\u7684\u4e13\u4e1a\u662f\u8ba1\u7b97\u673a\u79d1\u5b66&#xff0c;\u7231\u597dPython\u3001Java&#034;\u3002<\/p>\n<p>name &#061; &#034;lily&#034;<br \/>\nage &#061; 18           # age \u662f int \u7c7b\u578b<br \/>\npro &#061; &#034;\u8ba1\u7b97\u673a\u79d1\u5b66&#034;<br \/>\nhobby &#061; &#034;Python\u3001Java&#034;<br \/>\n&#043; \u53f7\u53ea\u8ba4\u5b57\u7b26\u4e32&#xff0c;age \u662f\u6574\u6570&#xff0c;\u6240\u4ee5\u5fc5\u987b\u5148 str(age) \u8f6c\u6210\u5b57\u7b26\u4e32\u518d\u62fc\u63a5<br \/>\nmessage &#061; &#034;\u5927\u5bb6\u597d&#xff0c;\u6211\u662f&#034; &#043; name &#043; &#034;&#xff0c;\u4eca\u5e74&#034; &#043; str(age) &#043; &#034;\u5c81&#xff0c;\u5b66\u4e60\u7684\u4e13\u4e1a\u662f&#034; &#043; pro &#043; &#034;&#xff0c;\u7231\u597d&#034; &#043; hobby<br \/>\nprint(message) <\/p>\n<p>&#043; \u62fc\u63a5\u7684\u5c40\u9650&#xff1a;\u5199\u6cd5\u5197\u957f\u3001\u975e\u5b57\u7b26\u4e32\u5fc5\u987b\u624b\u52a8\u8f6c\u6362&#xff0c;\u4e8e\u662f\u6709\u4e86\u4e0b\u9762\u7684\u5b57\u7b26\u4e32\u683c\u5f0f\u5316\u65b9\u6848\u3002<\/p>\n<h4 id=\"2.5%20%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%A0%BC%E5%BC%8F%E5%8C%96\">2.5 \u5b57\u7b26\u4e32\u683c\u5f0f\u5316<\/h4>\n<h5 id=\"2.5.1%20%E4%BD%BF%E7%94%A8%20%25%20%E5%8D%A0%E4%BD%8D%E7%AC%A6\">2.5.1 \u4f7f\u7528 % \u5360\u4f4d\u7b26<\/h5>\n<p>\u8bb0\u5fc6\u65b9\u6cd5&#xff1a;\u628a %s \u8bfb\u4f5c&#034;\u8fd9\u91cc\u7559\u4e00\u4e2a\u7a7a\u4f4d&#034;\u3002% \u8868\u793a\u5360\u4f4d&#xff0c;s \u8868\u793a\u628a\u586b\u5165\u7684\u6570\u636e\u5148\u8f6c\u6210\u5b57\u7b26\u4e32&#xff08;s &#061; string&#xff09;\u518d\u653e\u5230\u8fd9\u4e2a\u4f4d\u7f6e\u3002<\/p>\n<p>\u597d\u5904&#xff1a;\u56e0\u4e3a\u4f1a\u81ea\u52a8\u8f6c\u6210\u5b57\u7b26\u4e32&#xff0c;\u6240\u4ee5\u4efb\u4f55\u7c7b\u578b\u7684\u6570\u636e\u90fd\u80fd\u586b\u5165 %s&#xff0c;\u4e0d\u9700\u8981\u624b\u52a8 str() \u8f6c\u6362\u3002<\/p>\n<p># \u4e00\u4e2a\u5360\u4f4d\u7b26&#xff1a;\u5b57\u7b26\u4e32\u540e\u5199 % \u53d8\u91cf<br \/>\ns1 &#061; &#034;lily&#034;<br \/>\nprint(&#034;\u5927\u5bb6\u597d&#xff0c;\u6211\u662f%s&#xff0c;\u6b22\u8fce\u5927\u5bb6\u8fdb\u5165Python\u8bfe\u7a0b\u7684\u5b66\u4e60&#034; % s1)<br \/>\n\u591a\u4e2a\u5360\u4f4d\u7b26&#xff1a;\u6570\u636e\u7528\u62ec\u53f7\u5305\u8d77\u6765&#xff0c;\u6309\u987a\u5e8f\u4e00\u4e00\u5bf9\u5e94<br \/>\ns1 &#061; &#034;\u4eba\u751f\u82e6\u77ed&#034;<br \/>\ns2 &#061; &#034;\u6211\u7528Python&#034;<br \/>\nprint(&#034;\u5409\u591a\u00b7\u8303\u7f57\u82cf\u59c6&#xff1a;%s&#xff0c;%s&#034; % (s1, s2))<br \/>\n%s \u53ef\u4ee5\u63a5\u6536\u4efb\u610f\u7c7b\u578b&#xff0c;\u6570\u5b57\u4e5f\u4f1a\u81ea\u52a8\u8f6c\u6210\u5b57\u7b26\u4e32<br \/>\nprint(&#034;\u6211\u4eca\u5e74%s\u5c81&#034; % 18) <\/p>\n<h5 id=\"2.5.2%20%E4%BD%BF%E7%94%A8%20f-string%EF%BC%88%E6%8E%A8%E8%8D%90%EF%BC%89\">2.5.2 \u4f7f\u7528 f-string&#xff08;\u63a8\u8350&#xff09;<\/h5>\n<p>\u5728\u5b57\u7b26\u4e32\u524d\u52a0 f&#xff0c;\u7528 {} \u76f4\u63a5\u5d4c\u5165\u53d8\u91cf\u6216\u8868\u8fbe\u5f0f&#xff0c;\u8bed\u6cd5\u6700\u7b80\u6d01\u3001\u53ef\u8bfb\u6027\u6700\u597d\u3002<\/p>\n<p>name &#061; &#034;\u6d9b\u54e5&#034;<br \/>\nage &#061; 18<br \/>\nprint(f&#034;\u5927\u5bb6\u597d&#xff0c;\u6211\u662f{name}&#xff0c;\u4eca\u5e74{age}\u5c81&#034;)   # {} \u4e2d\u4e5f\u53ef\u4ee5\u5199\u8868\u8fbe\u5f0f&#xff0c;\u5982 {age &#043; 1}<br \/>\ns1 &#061; &#034;\u4eba\u751f\u82e6\u77ed&#034;<br \/>\ns2 &#061; &#034;\u6211\u7528Python&#034;<br \/>\nprint(f&#034;\u5409\u591a\u00b7\u8303\u7f57\u82cf\u59c6&#xff1a;{s1}&#xff0c;{s2}&#034;) <\/p>\n<p>\u5c0f\u7ed3&#xff1a;<\/p>\n<li>\u5b57\u7b26\u4e32\u62fc\u63a5&#xff1a;\u4f7f\u7528 &#043; \u53f7&#xff1b;\u4e0d\u80fd\u76f4\u63a5\u62fc\u63a5\u975e\u5b57\u7b26\u4e32&#xff0c;\u5176\u4ed6\u7c7b\u578b\u9700\u5148 str(&#8230;) \u8f6c\u6362\u3002<\/li>\n<li>% \u683c\u5f0f\u5316&#xff1a;&#034;%s&#034; % \u53d8\u91cf \/ &#034;%s\u2026%s&#034; % (\u53d8\u91cf1, \u53d8\u91cf2)&#xff0c;\u4efb\u610f\u7c7b\u578b\u81ea\u52a8\u8f6c\u5b57\u7b26\u4e32\u3002<\/li>\n<li>f-string \u683c\u5f0f\u5316&#xff08;\u63a8\u8350&#xff09;&#xff1a;f&#034;\u5185\u5bb9{\u53d8\u91cf\/\u8868\u8fbe\u5f0f}&#034;\u3002<\/li>\n<h3 id=\"%E4%B8%89%E3%80%81%E8%BE%93%E5%85%A5%E4%B8%8E%E8%BE%93%E5%87%BA\">\u4e09\u3001\u8f93\u5165\u4e0e\u8f93\u51fa<\/h3>\n<h4 id=\"3.1%20%E8%BE%93%E5%85%A5%20%E2%80%94%E2%80%94%20input()\">3.1 \u8f93\u5165 \u2014\u2014 input()<\/h4>\n<p>input() \u7528\u4e8e\u63a5\u6536\u952e\u76d8\u8f93\u5165&#xff0c;\u7a0b\u5e8f\u4f1a\u6682\u505c\u7b49\u5f85\u7528\u6237\u8f93\u5165&#xff0c;\u8f93\u5165\u7684\u5185\u5bb9\u4ee5\u8fd4\u56de\u503c\u7684\u5f62\u5f0f\u4ea4\u7ed9\u53d8\u91cf&#xff1a;<\/p>\n<p>s &#061; input(\u63d0\u793a\u4fe1\u606f)<\/p>\n<p>name &#061; input(&#034;\u8bf7\u8f93\u5165\u60a8\u7684\u59d3\u540d&#xff1a;&#034;)<br \/>\nprint(f&#034;\u6b22\u8fce\u60a8&#xff0c;{name}&#034;)<br \/>\nage &#061; input(&#034;\u8bf7\u8f93\u5165\u60a8\u7684\u5e74\u9f84&#xff1a;&#034;)<br \/>\nprint(f&#034;\u60a8\u4eca\u5e74{age}\u5c81&#034;) <\/p>\n<p>\u6ce8\u610f&#xff1a;\u65e0\u8bba\u7528\u6237\u8f93\u5165\u4ec0\u4e48&#xff0c;input() \u8fd4\u56de\u7684\u4e00\u5f8b\u662f\u5b57\u7b26\u4e32\u7c7b\u578b\u3002\u5982\u679c\u9700\u8981\u53c2\u4e0e\u6570\u5b66\u8fd0\u7b97&#xff0c;\u5fc5\u987b\u5148\u505a\u7c7b\u578b\u8f6c\u6362&#xff08;int() \/ float()&#xff09;\u3002<\/p>\n<h4 id=\"3.2%20%E8%BE%93%E5%87%BA%20%E2%80%94%E2%80%94%20print()\">3.2 \u8f93\u51fa \u2014\u2014 print()<\/h4>\n<p>print() \u7528\u4e8e\u628a\u6570\u636e\u8f93\u51fa\u5230\u63a7\u5236\u53f0&#xff0c;\u4e00\u6b21\u53ef\u4ee5\u8f93\u51fa\u591a\u4e2a\u6570\u636e&#xff0c;\u7528\u9017\u53f7\u5206\u9694&#xff1a;<\/p>\n<p>print(\u6570\u636e, &#8230;)<\/p>\n<p>print(&#034;Hello World&#034;)<br \/>\nprint(10)<br \/>\nprint(3.14)<br \/>\nprint(&#034;\u7ed3\u679c\u662f:&#034;, 10 &#043; 5)   # \u591a\u4e2a\u6570\u636e\u7528\u9017\u53f7\u5206\u9694&#xff0c;\u8f93\u51fa\u65f6\u81ea\u52a8\u4ee5\u7a7a\u683c\u9694\u5f00<\/p>\n<h4 id=\"3.3%20%E7%B1%BB%E5%9E%8B%E8%BD%AC%E6%8D%A2\">3.3 \u7c7b\u578b\u8f6c\u6362<\/h4>\n<table>\n<tr>\u8f6c\u6362\u51fd\u6570\u4f5c\u7528\u793a\u4f8b<\/tr>\n<tbody>\n<tr>\n<td>int(&#8230;)<\/td>\n<td>\u8f6c\u4e3a\u6574\u6570<\/td>\n<td>int(&#034;10&#034;) \u2192 10<\/td>\n<\/tr>\n<tr>\n<td>str(&#8230;)<\/td>\n<td>\u8f6c\u4e3a\u5b57\u7b26\u4e32<\/td>\n<td>str(18) \u2192 &#034;18&#034;<\/td>\n<\/tr>\n<tr>\n<td>float(&#8230;)<\/td>\n<td>\u8f6c\u4e3a\u6d6e\u70b9\u6570<\/td>\n<td>float(&#034;3.14&#034;) \u2192 3.14<\/td>\n<\/tr>\n<tr>\n<td>bool(&#8230;)<\/td>\n<td>\u8f6c\u4e3a\u5e03\u5c14\u503c<\/td>\n<td>bool(0) \u2192 False<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6848\u4f8b1&#xff1a;\u94f6\u884c\u5361 ATM \u53d6\u6b3e<\/p>\n<p>\u9700\u6c42&#xff1a;\u94f6\u884c\u5361\u4f59\u989d 10000 \u5143&#xff0c;\u6839\u636e\u8f93\u5165\u7684\u5bc6\u7801\u548c\u53d6\u6b3e\u91d1\u989d\u6267\u884c\u53d6\u6b3e&#xff0c;\u53d6\u6b3e\u5b8c\u6bd5\u540e\u5c55\u793a\u4f59\u989d\u3002<\/p>\n<p>balance &#061; 10000<br \/>\npassword &#061; input(&#034;\u8bf7\u8f93\u5165\u5bc6\u7801&#xff1a;&#034;)<br \/>\namount &#061; int(input(&#034;\u8bf7\u8f93\u5165\u53d6\u6b3e\u91d1\u989d&#xff1a;&#034;))   # input \u8fd4\u56de\u5b57\u7b26\u4e32&#xff0c;\u5fc5\u987b\u8f6c\u6210\u6570\u5b57\u624d\u80fd\u53c2\u4e0e\u51cf\u6cd5<br \/>\nbalance -&#061; amount                        # \u7b49\u6548\u4e8e balance &#061; balance &#8211; amount<br \/>\nprint(f&#034;\u53d6\u6b3e\u6210\u529f&#xff0c;\u5f53\u524d\u4f59\u989d&#xff1a;{balance}\u5143&#034;)<\/p>\n<p>\u5173\u952e\u70b9&#xff1a;input() \u5f97\u5230\u7684\u662f\u5b57\u7b26\u4e32&#xff0c;\u5b57\u7b26\u4e32\u4e0d\u80fd\u548c\u6574\u6570\u505a\u51cf\u6cd5&#xff0c;\u6240\u4ee5\u8981\u7528 int() \u8f6c\u6362\u540e\u518d\u8ba1\u7b97\u3002<\/p>\n<p>\u6848\u4f8b2&#xff1a;\u8ba1\u7b97\u4e24\u4e2a\u6570\u4e4b\u548c<\/p>\n<p>\u9700\u6c42&#xff1a;\u6839\u636e\u7528\u6237\u8f93\u5165\u7684\u4e24\u4e2a\u6570\u5b57&#xff0c;\u8ba1\u7b97\u5b83\u4eec\u7684\u548c\u5e76\u8f93\u51fa\u3002<\/p>\n<p>num1 &#061; float(input(&#034;\u8bf7\u8f93\u5165\u7b2c\u4e00\u4e2a\u6570\u5b57&#xff1a;&#034;))<br \/>\nnum2 &#061; float(input(&#034;\u8bf7\u8f93\u5165\u7b2c\u4e8c\u4e2a\u6570\u5b57&#xff1a;&#034;))<br \/>\nprint(f&#034;\u4e24\u6570\u4e4b\u548c\u4e3a&#xff1a;{num1 &#043; num2}&#034;)<\/p>\n<p>\u5e38\u89c1\u9519\u8bef&#xff1a;\u5148\u62fc\u63a5\u3001\u540e\u8f6c\u6362\u662f\u9519\u7684\u3002<\/p>\n<p>num1 &#061; input(&#034;\u8bf7\u8f93\u5165\u7b2c\u4e00\u4e2a\u6570\u5b57&#xff1a;&#034;)   # \u8f93\u5165 1&#xff0c;\u5f97\u5230\u5b57\u7b26\u4e32 &#034;1&#034;<br \/>\nnum2 &#061; input(&#034;\u8bf7\u8f93\u5165\u7b2c\u4e8c\u4e2a\u6570\u5b57&#xff1a;&#034;)   # \u8f93\u5165 2&#xff0c;\u5f97\u5230\u5b57\u7b26\u4e32 &#034;2&#034;<br \/>\nint(num1 &#043; num2)      # \u9519&#xff1a;\u5b57\u7b26\u4e32\u7684 &#043; \u662f\u62fc\u63a5&#xff0c;&#034;1&#034; &#043; &#034;2&#034; \u5f97\u5230 &#034;12&#034;&#xff0c;\u518d\u8f6c\u6210 12&#xff0c;\u4e0d\u662f 3<br \/>\nint(num1) &#043; int(num2) # \u5bf9&#xff1a;\u5148\u628a\u6bcf\u4e2a\u5b57\u7b26\u4e32\u5404\u81ea\u8f6c\u6210\u6570\u5b57&#xff0c;\u518d\u505a\u52a0\u6cd5 <\/p>\n<p>\u5c0f\u7ed3&#xff1a;<\/p>\n<li>\u83b7\u53d6\u7528\u6237\u8f93\u5165&#xff1a;s &#061; input(\u63d0\u793a\u4fe1\u606f)&#xff0c;\u7ed3\u679c\u6c38\u8fdc\u662f\u5b57\u7b26\u4e32\u3002<\/li>\n<li>\u7c7b\u578b\u8f6c\u6362&#xff1a;int(&#8230;)\u3001str(&#8230;)\u3001float(&#8230;)\u3001bool(&#8230;)\u3002<\/li>\n<h3 id=\"%E5%9B%9B%E3%80%81%E8%BF%90%E7%AE%97%E7%AC%A6\">\u56db\u3001\u8fd0\u7b97\u7b26<\/h3>\n<h4 id=\"4.1%20%E7%AE%97%E6%9C%AF%E8%BF%90%E7%AE%97%E7%AC%A6\">4.1 \u7b97\u672f\u8fd0\u7b97\u7b26<\/h4>\n<p>\u7b97\u672f\u8fd0\u7b97\u7b26\u7528\u4e8e\u6267\u884c\u57fa\u672c\u7684\u6570\u5b66\u8fd0\u7b97\u3002<\/p>\n<table>\n<tr>\u8fd0\u7b97\u7b26\u63cf\u8ff0\u793a\u4f8b<\/tr>\n<tbody>\n<tr>\n<td>&#043;<\/td>\n<td>\u52a0\u6cd5<\/td>\n<td>8 &#043; 3 \u2192 11<\/td>\n<\/tr>\n<tr>\n<td>&#8211;<\/td>\n<td>\u51cf\u6cd5<\/td>\n<td>8 &#8211; 3 \u2192 5<\/td>\n<\/tr>\n<tr>\n<td>*<\/td>\n<td>\u4e58\u6cd5<\/td>\n<td>3 * 8 \u2192 24<\/td>\n<\/tr>\n<tr>\n<td>\/<\/td>\n<td>\u9664\u6cd5<\/td>\n<td>10 \/ 5 \u2192 2.0&#xff08;\u7ed3\u679c\u4e00\u5b9a\u662f\u5c0f\u6570&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\/\/<\/td>\n<td>\u6574\u9664&#xff08;\u5411\u4e0b\u53d6\u6574&#xff09;<\/td>\n<td>10 \/\/ 3 \u2192 3<\/td>\n<\/tr>\n<tr>\n<td>%<\/td>\n<td>\u53d6\u4f59&#xff08;\u6c42\u6a21&#xff09;<\/td>\n<td>10 % 3 \u2192 1&#xff08;10 \u9664\u4ee5 3 \u53d6\u4f59\u6570&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>**<\/td>\n<td>\u5e42&#xff08;\u4e58\u65b9&#xff09;<\/td>\n<td>10 ** 3 \u2192 1000<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4ee3\u7801\u793a\u4f8b&#xff1a;<\/p>\n<p>print(8 &#043; 3)    # 11<br \/>\nprint(8 &#8211; 3)    # 5<br \/>\nprint(3 * 8)    # 24<br \/>\nprint(10 \/ 5)   # 2.0  \u9664\u6cd5\u7ed3\u679c\u6c38\u8fdc\u662f\u6d6e\u70b9\u6570<br \/>\nprint(10 \/\/ 3)  # 3    \u53ea\u4fdd\u7559\u6574\u6570\u90e8\u5206<br \/>\nprint(10 % 3)   # 1    \u4f59\u6570<br \/>\nprint(10 ** 3)  # 1000 \u5e42\u8fd0\u7b97<br \/>\n\u4f18\u5148\u7ea7&#xff1a;() \u6700\u9ad8 &gt; ** &gt; * \/ \/\/ % &gt; &#043; &#8211;<br \/>\nprint(0.1 &#043; 10 \/ 4 ** 2)   # \u5148\u7b97 4**2&#061;16&#xff0c;\u518d\u7b97 10\/16&#061;0.625&#xff0c;\u6700\u540e\u52a0 0.1 \u2192 0.725 <\/p>\n<p>\u6848\u4f8b1&#xff1a;\u8f93\u5165\u4e24\u4e2a\u6570 x \u4e0e y&#xff0c;\u5206\u522b\u8f93\u51fa x&#043;y \u548c x-y \u7684\u7ed3\u679c\u3002<\/p>\n<p>x &#061; float(input(&#034;\u8bf7\u8f93\u5165x&#xff1a;&#034;))<br \/>\ny &#061; float(input(&#034;\u8bf7\u8f93\u5165y&#xff1a;&#034;))<br \/>\nprint(f&#034;x &#043; y &#061; {x &#043; y}&#034;)<br \/>\nprint(f&#034;x &#8211; y &#061; {x &#8211; y}&#034;)<\/p>\n<p>\u6d6e\u70b9\u6570\u7cbe\u5ea6\u635f\u5931&#xff1a;\u8ba1\u7b97\u673a\u5e95\u5c42\u7528\u4e8c\u8fdb\u5236\u5b58\u50a8\u6570\u636e&#xff0c;\u800c\u4e8c\u8fdb\u5236\u65e0\u6cd5\u7cbe\u786e\u8868\u793a\u6240\u6709\u5c0f\u6570&#xff08;\u5c31\u50cf\u5341\u8fdb\u5236\u65e0\u6cd5\u7528\u6709\u9650\u4f4d\u6570\u5199\u51fa 1\/3&#xff09;&#xff0c;\u6240\u4ee5\u6d6e\u70b9\u8fd0\u7b97\u53ef\u80fd\u51fa\u73b0\u8bef\u5dee&#xff0c;\u4f8b\u5982 0.1 &#043; 0.2 \u7684\u7ed3\u679c\u662f 0.30000000000000004\u3002\u8fd9\u662f\u6240\u6709\u7f16\u7a0b\u8bed\u8a00\u7684\u901a\u75c5&#xff0c;\u4e0d\u662f Python \u7684 bug\u3002\u4e00\u822c\u573a\u666f\u53ef\u4ee5\u7528 round(x, 2) \u56db\u820d\u4e94\u5165\u5230\u6307\u5b9a\u5c0f\u6570\u4f4d&#xff1b;\u5bf9\u7cbe\u5ea6\u8981\u6c42\u9ad8\u7684\u573a\u666f&#xff08;\u5982\u91d1\u989d\u8ba1\u7b97&#xff09;\u4f7f\u7528 decimal \u6a21\u5757\u3002<\/p>\n<p>\u6848\u4f8b2&#xff1a;\u8f93\u5165\u4e09\u4e2a\u6574\u6570&#xff0c;\u8ba1\u7b97\u5e73\u5747\u6570\u3002<\/p>\n<p>a &#061; int(input(&#034;\u8bf7\u8f93\u5165\u7b2c\u4e00\u4e2a\u6574\u6570&#xff1a;&#034;))<br \/>\nb &#061; int(input(&#034;\u8bf7\u8f93\u5165\u7b2c\u4e8c\u4e2a\u6574\u6570&#xff1a;&#034;))<br \/>\nc &#061; int(input(&#034;\u8bf7\u8f93\u5165\u7b2c\u4e09\u4e2a\u6574\u6570&#xff1a;&#034;))<br \/>\navg &#061; (a &#043; b &#043; c) \/ 3<br \/>\nprint(f&#034;\u5e73\u5747\u6570\u4e3a&#xff1a;{avg}&#034;)<\/p>\n<p>\u6848\u4f8b3&#xff1a;\u8f93\u5165\u68af\u5f62\u7684\u4e0a\u5e95\u3001\u4e0b\u5e95\u3001\u9ad8&#xff0c;\u8ba1\u7b97\u68af\u5f62\u9762\u79ef\u3002<\/p>\n<p>upper &#061; float(input(&#034;\u8bf7\u8f93\u5165\u4e0a\u5e95&#xff1a;&#034;))<br \/>\nlower &#061; float(input(&#034;\u8bf7\u8f93\u5165\u4e0b\u5e95&#xff1a;&#034;))<br \/>\nheight &#061; float(input(&#034;\u8bf7\u8f93\u5165\u9ad8&#xff1a;&#034;))<br \/>\narea &#061; (upper &#043; lower) * height \/ 2<br \/>\nprint(f&#034;\u68af\u5f62\u9762\u79ef\u4e3a&#xff1a;{area}&#034;)<\/p>\n<p>\u6848\u4f8b4&#xff1a;\u8f93\u5165\u5706\u7684\u534a\u5f84&#xff0c;\u8ba1\u7b97\u5706\u7684\u5468\u957f\u548c\u9762\u79ef&#xff08;\u5468\u957f&#xff1a;2\u03c0r&#xff0c;\u9762\u79ef&#xff1a;\u03c0r\u00b2&#xff09;\u3002<\/p>\n<p>import math<br \/>\nr &#061; float(input(&#034;\u8bf7\u8f93\u5165\u5706\u7684\u534a\u5f84&#xff1a;&#034;))<br \/>\ncircumference &#061; 2 * math.pi * r<br \/>\narea &#061; math.pi * r ** 2<br \/>\nprint(f&#034;\u5706\u7684\u5468\u957f\u4e3a&#xff1a;{circumference}&#034;)<br \/>\nprint(f&#034;\u5706\u7684\u9762\u79ef\u4e3a&#xff1a;{area}&#034;)<\/p>\n<p>\u6848\u4f8b5&#xff1a;\u8ba1\u7b97\u8eab\u4f53\u8d28\u91cf\u6307\u6570 BMI&#xff08;BMI &#061; \u4f53\u91cd(kg) \/ \u8eab\u9ad8(m)\u00b2&#xff09;\u3002<\/p>\n<p>weight &#061; float(input(&#034;\u8bf7\u8f93\u5165\u4f53\u91cd&#xff08;kg&#xff09;&#xff1a;&#034;))<br \/>\nheight &#061; float(input(&#034;\u8bf7\u8f93\u5165\u8eab\u9ad8&#xff08;m&#xff09;&#xff1a;&#034;))<br \/>\nbmi &#061; weight \/ (height ** 2)<br \/>\nprint(f&#034;\u60a8\u7684BMI\u6307\u6570\u4e3a&#xff1a;{bmi}&#034;)<\/p>\n<p>\u5c0f\u7ed3&#xff1a;<\/p>\n<ul>\n<li>\u7b97\u672f\u8fd0\u7b97\u7b26&#xff1a;&#043;\u3001-\u3001*\u3001\/\u3001\/\/\u3001%\u3001**\u3002<\/li>\n<li>\u6ce8\u610f\u4e8b\u9879&#xff1a;\u6d89\u53ca\u6d6e\u70b9\u6570\u7684\u8fd0\u7b97\u53ef\u80fd\u635f\u5931\u7cbe\u5ea6&#xff08;\u8ba1\u7b97\u673a\u5e95\u5c42\u57fa\u4e8e\u4e8c\u8fdb\u5236\u5b58\u50a8\u548c\u5904\u7406\u6570\u636e&#xff0c;\u4e8c\u8fdb\u5236\u65e0\u6cd5\u7cbe\u786e\u8868\u793a\u6240\u6709\u5c0f\u6570&#xff09;\u3002<\/li>\n<\/ul>\n<h4 id=\"4.2%20%E8%B5%8B%E5%80%BC%E8%BF%90%E7%AE%97%E7%AC%A6\">4.2 \u8d4b\u503c\u8fd0\u7b97\u7b26<\/h4>\n<p>\u8d4b\u503c\u8fd0\u7b97\u7b26\u7528\u4e8e\u628a\u53f3\u4fa7\u7684\u503c&#xff08;\u6216\u8868\u8fbe\u5f0f\u7684\u7ed3\u679c&#xff09;\u4fdd\u5b58\u5230\u5de6\u4fa7\u7684\u53d8\u91cf\u4e2d\u3002<\/p>\n<table>\n<tr>\u8fd0\u7b97\u7b26\u63cf\u8ff0\u5b9e\u4f8b<\/tr>\n<tbody>\n<tr>\n<td>&#061;<\/td>\n<td>\u8d4b\u503c<\/td>\n<td>num &#061; 1 &#043; 2&#xff0c;\u7ed3\u679c num \u7684\u503c\u4e3a 3<\/td>\n<\/tr>\n<tr>\n<td>&#043;&#061;<\/td>\n<td>\u52a0\u6cd5\u8d4b\u503c<\/td>\n<td>num &#043;&#061; 2 \u7b49\u6548\u4e8e num &#061; num &#043; 2<\/td>\n<\/tr>\n<tr>\n<td>-&#061;<\/td>\n<td>\u51cf\u6cd5\u8d4b\u503c<\/td>\n<td>num -&#061; 2 \u7b49\u6548\u4e8e num &#061; num &#8211; 2<\/td>\n<\/tr>\n<tr>\n<td>*&#061;<\/td>\n<td>\u4e58\u6cd5\u8d4b\u503c<\/td>\n<td>num *&#061; 2 \u7b49\u6548\u4e8e num &#061; num * 2<\/td>\n<\/tr>\n<tr>\n<td>\/&#061;<\/td>\n<td>\u9664\u6cd5\u8d4b\u503c<\/td>\n<td>num \/&#061; 2 \u7b49\u6548\u4e8e num &#061; num \/ 2<\/td>\n<\/tr>\n<tr>\n<td>%&#061;<\/td>\n<td>\u53d6\u4f59\u8d4b\u503c<\/td>\n<td>num %&#061; 2 \u7b49\u6548\u4e8e num &#061; num % 2<\/td>\n<\/tr>\n<tr>\n<td>\/\/&#061;<\/td>\n<td>\u6574\u9664\u8d4b\u503c<\/td>\n<td>num \/\/&#061; 2 \u7b49\u6548\u4e8e num &#061; num \/\/ 2<\/td>\n<\/tr>\n<tr>\n<td>**&#061;<\/td>\n<td>\u5e42\u8d4b\u503c<\/td>\n<td>num **&#061; 2 \u7b49\u6548\u4e8e num &#061; num ** 2<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4ee3\u7801\u793a\u4f8b&#xff1a;<\/p>\n<p>num &#061; 85<br \/>\nprint(num)   # 85<br \/>\nnum &#043;&#061; 10    # \u7b49\u6548 num &#061; num &#043; 10<br \/>\nprint(num)   # 95<br \/>\nnum -&#061; 10    # \u7b49\u6548 num &#061; num &#8211; 10<br \/>\nprint(num)   # 85<br \/>\nnum *&#061; 10    # \u7b49\u6548 num &#061; num * 10<br \/>\nprint(num)   # 850<br \/>\nnum \/&#061; 10    # \u7b49\u6548 num &#061; num \/ 10<br \/>\nprint(num)   # 85.0  \u7ed3\u679c\u53d8\u6210\u4e86\u6d6e\u70b9\u6570&#xff01;<br \/>\nnum \/\/&#061; 10   # \u7b49\u6548 num &#061; num \/\/ 10<br \/>\nprint(num)   # 8.0<br \/>\nnum %&#061; 3     # \u7b49\u6548 num &#061; num % 3<br \/>\nprint(num)   # 2.0<br \/>\nnum **&#061; 3    # \u7b49\u6548 num &#061; num ** 3<br \/>\nprint(num)   # 8.0 <\/p>\n<p>\u4e3a\u4ec0\u4e48 \/&#061; \u4e4b\u540e\u53d8\u91cf\u53d8\u6210\u4e86\u6d6e\u70b9\u6570&#xff1f; Python 3 \u4e2d \/ \u662f\u771f\u9664\u6cd5&#xff0c;\u65e0\u8bba\u64cd\u4f5c\u6570\u662f\u4e0d\u662f\u6574\u6570&#xff0c;\u7ed3\u679c\u4e00\u5f8b\u662f float&#xff08;850 \/ 10 \u5f97\u5230 85.0 \u800c\u4e0d\u662f 85&#xff09;&#xff0c;\u590d\u5408\u8d4b\u503c \/&#061; \u540c\u7406&#xff1b;\u800c &#043;&#061;\u3001-&#061;\u3001*&#061; \u5728\u4e24\u4e2a\u6574\u6570\u4e4b\u95f4\u8fd0\u7b97\u65f6\u4ecd\u4fdd\u6301\u6574\u6570\u3002\u8fd9\u6b63\u662f\u666e\u901a\u9664\u6cd5 \/ \u4e0e\u6574\u9664 \/\/ \u7684\u5173\u952e\u533a\u522b\u3002<\/p>\n<h4 id=\"4.3%20%E6%AF%94%E8%BE%83%E8%BF%90%E7%AE%97%E7%AC%A6\">4.3 \u6bd4\u8f83\u8fd0\u7b97\u7b26<\/h4>\n<p>\u6bd4\u8f83\u8fd0\u7b97\u7b26&#xff08;\u5173\u7cfb\u8fd0\u7b97\u7b26&#xff09;\u7528\u4e8e\u6bd4\u8f83\u4e24\u4e2a\u503c\u7684\u5927\u5c0f\u6216\u76f8\u7b49\u5173\u7cfb&#xff0c;\u7ed3\u679c\u4e00\u5b9a\u662f\u5e03\u5c14\u503c&#xff1a;\u5173\u7cfb\u6210\u7acb\u4e3a True&#xff0c;\u4e0d\u6210\u7acb\u4e3a False\u3002<\/p>\n<table>\n<tr>\u8fd0\u7b97\u7b26\u63cf\u8ff0\u793a\u4f8b<\/tr>\n<tbody>\n<tr>\n<td>&#061;&#061;<\/td>\n<td>\u7b49\u4e8e<\/td>\n<td>a &#061;&#061; b&#xff1a;\u5224\u65ad a \u662f\u5426\u7b49\u4e8e b<\/td>\n<\/tr>\n<tr>\n<td>!&#061;<\/td>\n<td>\u4e0d\u7b49\u4e8e<\/td>\n<td>a !&#061; b&#xff1a;\u5224\u65ad a \u662f\u5426\u4e0d\u7b49\u4e8e b<\/td>\n<\/tr>\n<tr>\n<td>&gt;<\/td>\n<td>\u5927\u4e8e<\/td>\n<td>a &gt; b&#xff1a;\u5224\u65ad a \u662f\u5426\u5927\u4e8e b<\/td>\n<\/tr>\n<tr>\n<td>&gt;&#061;<\/td>\n<td>\u5927\u4e8e\u7b49\u4e8e<\/td>\n<td>a &gt;&#061; b&#xff1a;\u5224\u65ad a \u662f\u5426\u5927\u4e8e\u7b49\u4e8e b<\/td>\n<\/tr>\n<tr>\n<td>&lt;<\/td>\n<td>\u5c0f\u4e8e<\/td>\n<td>a &lt; b&#xff1a;\u5224\u65ad a \u662f\u5426\u5c0f\u4e8e b<\/td>\n<\/tr>\n<tr>\n<td>&lt;&#061;<\/td>\n<td>\u5c0f\u4e8e\u7b49\u4e8e<\/td>\n<td>a &lt;&#061; b&#xff1a;\u5224\u65ad a \u662f\u5426\u5c0f\u4e8e\u7b49\u4e8e b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4ee3\u7801\u793a\u4f8b&#xff1a;<\/p>\n<p>a, b &#061; 10, 20<br \/>\nprint(a &#061;&#061; b)   # False<br \/>\nprint(a !&#061; b)   # True<br \/>\nprint(a &gt; b)    # False<br \/>\nprint(a &gt;&#061; b)   # False<br \/>\nprint(a &lt; b)    # True<br \/>\nprint(a &lt;&#061; b)   # True<br \/>\n\u6ce8\u610f&#xff1a;&#061;&#061; \u662f\u6bd4\u8f83\u662f\u5426\u76f8\u7b49&#xff0c;&#061; \u662f\u8d4b\u503c&#xff0c;\u4e24\u8005\u5b8c\u5168\u4e0d\u540c <\/p>\n<p>\u5178\u578b\u5e94\u7528\u573a\u666f&#xff1a;<\/p>\n<p># \u5224\u65ad\u4e00\u4e2a\u6570\u662f\u5426\u4e3a\u5076\u6570&#xff1a;\u80fd\u88ab 2 \u6574\u9664&#xff08;\u4f59\u6570\u4e3a 0&#xff09;<br \/>\nnum &#061; 8<br \/>\nprint(num % 2 &#061;&#061; 0)          # True<br \/>\n\u7535\u5546\u652f\u4ed8&#xff1a;\u5224\u65ad\u94f6\u884c\u5361\u4f59\u989d\u662f\u5426\u8db3\u591f<br \/>\nbalance, price &#061; 99.9, 59.9<br \/>\nprint(balance &gt;&#061; price)      # True<br \/>\n\u7535\u5546\u8d2d\u4e70&#xff1a;\u5224\u65ad\u8d27\u7269\u5e93\u5b58\u662f\u5426\u8db3\u591f<br \/>\nstock, quantity &#061; 3, 5<br \/>\nprint(stock &gt;&#061; quantity)     # False<br \/>\n\u70b9\u9910\u7b5b\u9009&#xff1a;\u4ef7\u683c\u4e0d\u8d85\u8fc7 100 \u5143<br \/>\nprice &#061; 88<br \/>\nprint(price &lt;&#061; 100)          # True <\/p>\n<h4 id=\"4.4%20%E9%80%BB%E8%BE%91%E8%BF%90%E7%AE%97%E7%AC%A6\">4.4 \u903b\u8f91\u8fd0\u7b97\u7b26<\/h4>\n<p>\u903b\u8f91\u8fd0\u7b97\u7b26\u7528\u4e8e\u8fde\u63a5\u591a\u4e2a\u5e03\u5c14\u8868\u8fbe\u5f0f&#xff08;\u5176\u503c\u4e3a&#034;\u771f&#034;\u6216&#034;\u5047&#034;&#xff09;&#xff0c;\u5e76\u8fd4\u56de\u4e00\u4e2a\u6700\u7ec8\u7684\u5e03\u5c14\u7ed3\u679c\u3002<\/p>\n<table>\n<tr>\u8fd0\u7b97\u7b26\u63cf\u8ff0\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>and<\/td>\n<td>\u903b\u8f91\u4e0e&#xff08;\u5e76\u4e14&#xff09;<\/td>\n<td>\u5de6\u53f3\u4e24\u8fb9\u90fd\u4e3a True&#xff0c;\u7ed3\u679c\u624d\u4e3a True<\/td>\n<\/tr>\n<tr>\n<td>or<\/td>\n<td>\u903b\u8f91\u6216&#xff08;\u6216\u8005&#xff09;<\/td>\n<td>\u5de6\u53f3\u4e24\u8fb9\u53ea\u8981\u6709\u4e00\u4e2a\u4e3a True&#xff0c;\u7ed3\u679c\u5c31\u4e3a True<\/td>\n<\/tr>\n<tr>\n<td>not<\/td>\n<td>\u903b\u8f91\u975e&#xff08;\u53d6\u53cd&#xff09;<\/td>\n<td>True \u53d8\u4e3a False&#xff0c;False \u53d8\u4e3a True<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4ee3\u7801\u793a\u4f8b&#xff1a;<\/p>\n<p>print(True and True)    # True   \u4e24\u8005\u90fd\u6210\u7acb<br \/>\nprint(True and False)   # False<br \/>\nprint(True or False)    # True   \u6709\u4e00\u4e2a\u6210\u7acb\u5373\u53ef<br \/>\nprint(False or False)   # False<br \/>\nprint(not True)         # False  \u53d6\u53cd<br \/>\nprint(not False)        # True<br \/>\nage &#061; 25<br \/>\nprint(age &gt;&#061; 18 and age &lt;&#061; 60)   # True&#xff1a;\u5e74\u9f84\u5728 18~60 \u4e4b\u95f4 <\/p>\n<p>\u6848\u4f8b1&#xff1a;\u952e\u76d8\u8f93\u5165\u4e00\u4e2a\u6574\u6570&#xff0c;\u5224\u65ad\u5b83\u662f\u5426\u5728 10~20 \u4e4b\u95f4&#xff08;\u542b\u8fb9\u754c&#xff09;\u3002<\/p>\n<p>num &#061; int(input(&#034;\u8bf7\u8f93\u5165\u4e00\u4e2a\u6574\u6570&#xff1a;&#034;))<br \/>\nprint(f&#034;\u662f\u5426\u572810-20\u4e4b\u95f4&#xff1a;{num &gt;&#061; 10 and num &lt;&#061; 20}&#034;)<\/p>\n<p>\u6848\u4f8b2&#xff1a;\u952e\u76d8\u8f93\u5165\u4e00\u4e2a\u6574\u6570&#xff0c;\u5224\u65ad\u5b83\u662f\u5426\u4e0d\u5728 10~20 \u4e4b\u95f4\u3002<\/p>\n<p>num &#061; int(input(&#034;\u8bf7\u8f93\u5165\u4e00\u4e2a\u6574\u6570&#xff1a;&#034;))<br \/>\nprint(f&#034;\u662f\u5426\u4e0d\u572810-20\u4e4b\u95f4&#xff1a;{num &lt; 10 or num &gt; 20}&#034;)<\/p>\n<p>not \u4ec0\u4e48\u65f6\u5019\u7528&#xff1f; \u5f53\u903b\u8f91\u662f&#034;\u67d0\u4e2a\u6761\u4ef6\u4e0d\u6210\u7acb\u65f6\u624d\u2026\u2026&#034;&#xff0c;\u6216\u9700\u8981\u5bf9\u5df2\u6709\u7684\u5e03\u5c14\u53d8\u91cf\u3001\u5224\u65ad\u7ed3\u679c\u6574\u4f53\u53d6\u53cd\u65f6\u4f7f\u7528&#xff0c;\u53ef\u4ee5\u907f\u514d\u5199\u51fa\u5570\u55e6\u7684\u5426\u5b9a\u6761\u4ef6&#xff1a;<\/p>\n<p> is_vip &#061; False<br \/>\nif not is_vip:          # \u4e0d\u662f\u4f1a\u5458\u65f6\u6267\u884c&#xff0c;\u6bd4 is_vip &#061;&#061; False \u66f4\u89c4\u8303<br \/>\n    print(&#034;\u8bf7\u5f00\u901a\u4f1a\u5458&#034;)<br \/>\n&#034;\u4e0d\u5728 10~20 \u4e4b\u95f4&#034;\u7684\u53e6\u4e00\u79cd\u5199\u6cd5&#xff1a;\u5148\u7b97\u51fa&#034;\u5728\u4e4b\u95f4&#034;&#xff0c;\u518d\u6574\u4f53\u53d6\u53cd<br \/>\nprint(not (10 &lt;&#061; num &lt;&#061; 20)) <\/p>\n<p>\u5178\u578b\u5e94\u7528\u573a\u666f&#xff1a;<\/p>\n<table>\n<tr>\u573a\u666f\u903b\u8f91\u8fd0\u7b97\u7b26\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>\u5bc6\u7801\u767b\u5f55&#xff1a;\u7528\u6237\u540d\u6b63\u786e\u5e76\u4e14\u5bc6\u7801\u6b63\u786e<\/td>\n<td>and<\/td>\n<td>\u4e24\u4e2a\u6761\u4ef6\u540c\u65f6\u6ee1\u8db3<\/td>\n<\/tr>\n<tr>\n<td>\u767b\u5f55\u65b9\u5f0f&#xff1a;\u626b\u7801\u767b\u5f55\u6216\u8005\u5bc6\u7801\u767b\u5f55\u6216\u8005\u77ed\u4fe1\u767b\u5f55<\/td>\n<td>or<\/td>\n<td>\u6ee1\u8db3\u5176\u4e2d\u4e00\u4e2a\u5373\u53ef<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5c0f\u7ed3&#xff1a;<\/p>\n<li>\u903b\u8f91\u8fd0\u7b97\u7b26\u7528\u4e8e\u8fde\u63a5\u591a\u4e2a\u5e03\u5c14\u8868\u8fbe\u5f0f&#xff0c;\u8fd4\u56de\u4e00\u4e2a\u6700\u7ec8\u7684\u5e03\u5c14\u503c\u3002<\/li>\n<li>\u4e09\u79cd\u903b\u8f91\u8fd0\u7b97\u7b26&#xff1a;and&#xff08;\u5e76\u4e14&#xff0c;\u540c\u65f6\u6210\u7acb&#xff09;\u3001or&#xff08;\u6216\u8005&#xff0c;\u6ee1\u8db3\u5176\u4e00&#xff09;\u3001not&#xff08;\u975e&#xff0c;\u53d6\u53cd&#xff09;\u3002<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u6458\u8981&#xff1a;\u672c\u6587\u7cfb\u7edf\u8bb2\u89e3 Python \u7f16\u7a0b\u5165\u95e8\u7684\u57fa\u7840\u77e5\u8bc6&#xff0c;\u6db5\u76d6\u5b57\u9762\u91cf\u4e0e\u53d8\u91cf\u3001\u5e38\u89c1\u6570\u636e\u7c7b\u578b\u3001\u8f93\u5165\u8f93\u51fa\u4ee5\u53ca\u8fd0\u7b97\u7b26\u56db\u5927\u6838\u5fc3\u6a21\u5757\u3002\u5185\u5bb9\u4ece\u5b57\u9762\u91cf\u7684\u4e66\u5199\u683c\u5f0f\u3001\u53d8\u91cf\u7684\u5b9a\u4e49\u4e0e\u4f7f\u7528\u3001\u6807\u8bc6\u7b26\u7684\u547d\u540d\u89c4\u5219\u4e0e\u89c4\u8303&#xff0c;\u5230\u6574\u6570\u3001\u6d6e\u70b9\u6570\u3001\u5b57\u7b26\u4e32\u3001\u5e03\u5c14\u7b49\u57fa\u7840\u6570\u636e\u7c7b\u578b&#xff0c;\u518d\u5230 input() \u8f93\u5165\u3001print() \u8f93\u51fa\u4e0e\u7c7b\u578b\u8f6c\u6362&#xff0c;\u6700\u540e\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u7b97\u672f\u3001\u8d4b\u503c\u3001\u6bd4\u8f83\u548c\u903b\u8f91\u56db\u7c7b\u8fd0\u7b97\u7b26\u7684\u7528\u6cd5&#xff0c;\u5e76\u914d\u6709\u5927\u91cf\u53ef\u8fd0\u884c\u7684\u4ee3\u7801\u793a\u4f8b\u4e0e\u5b9e\u6218\u6848\u4f8b&#xff0c;\u5e2e<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[11820,81,50],"topic":[],"class_list":["post-108054","post","type-post","status-publish","format-standard","hentry","category-server","tag-atomgit","tag-python","tag-50"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python\u57fa\u784002 \u5b57\u9762\u91cf\u3001\u53d8\u91cf\u3001\u6570\u636e\u7c7b\u578b\u3001\u8f93\u5165\u8f93\u51fa\u4e0e\u8fd0\u7b97\u7b26 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/108054.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python\u57fa\u784002 \u5b57\u9762\u91cf\u3001\u53d8\u91cf\u3001\u6570\u636e\u7c7b\u578b\u3001\u8f93\u5165\u8f93\u51fa\u4e0e\u8fd0\u7b97\u7b26 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6458\u8981&#xff1a;\u672c\u6587\u7cfb\u7edf\u8bb2\u89e3 Python \u7f16\u7a0b\u5165\u95e8\u7684\u57fa\u7840\u77e5\u8bc6&#xff0c;\u6db5\u76d6\u5b57\u9762\u91cf\u4e0e\u53d8\u91cf\u3001\u5e38\u89c1\u6570\u636e\u7c7b\u578b\u3001\u8f93\u5165\u8f93\u51fa\u4ee5\u53ca\u8fd0\u7b97\u7b26\u56db\u5927\u6838\u5fc3\u6a21\u5757\u3002\u5185\u5bb9\u4ece\u5b57\u9762\u91cf\u7684\u4e66\u5199\u683c\u5f0f\u3001\u53d8\u91cf\u7684\u5b9a\u4e49\u4e0e\u4f7f\u7528\u3001\u6807\u8bc6\u7b26\u7684\u547d\u540d\u89c4\u5219\u4e0e\u89c4\u8303&#xff0c;\u5230\u6574\u6570\u3001\u6d6e\u70b9\u6570\u3001\u5b57\u7b26\u4e32\u3001\u5e03\u5c14\u7b49\u57fa\u7840\u6570\u636e\u7c7b\u578b&#xff0c;\u518d\u5230 input() \u8f93\u5165\u3001print() \u8f93\u51fa\u4e0e\u7c7b\u578b\u8f6c\u6362&#xff0c;\u6700\u540e\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u7b97\u672f\u3001\u8d4b\u503c\u3001\u6bd4\u8f83\u548c\u903b\u8f91\u56db\u7c7b\u8fd0\u7b97\u7b26\u7684\u7528\u6cd5&#xff0c;\u5e76\u914d\u6709\u5927\u91cf\u53ef\u8fd0\u884c\u7684\u4ee3\u7801\u793a\u4f8b\u4e0e\u5b9e\u6218\u6848\u4f8b&#xff0c;\u5e2e\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/108054.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-20T13:49:11+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/108054.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/108054.html\",\"name\":\"Python\u57fa\u784002 \u5b57\u9762\u91cf\u3001\u53d8\u91cf\u3001\u6570\u636e\u7c7b\u578b\u3001\u8f93\u5165\u8f93\u51fa\u4e0e\u8fd0\u7b97\u7b26 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-20T13:49:11+00:00\",\"dateModified\":\"2026-09-20T13:49:11+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/108054.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/108054.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/108054.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\u57fa\u784002 \u5b57\u9762\u91cf\u3001\u53d8\u91cf\u3001\u6570\u636e\u7c7b\u578b\u3001\u8f93\u5165\u8f93\u51fa\u4e0e\u8fd0\u7b97\u7b26\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python\u57fa\u784002 \u5b57\u9762\u91cf\u3001\u53d8\u91cf\u3001\u6570\u636e\u7c7b\u578b\u3001\u8f93\u5165\u8f93\u51fa\u4e0e\u8fd0\u7b97\u7b26 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/108054.html","og_locale":"zh_CN","og_type":"article","og_title":"Python\u57fa\u784002 \u5b57\u9762\u91cf\u3001\u53d8\u91cf\u3001\u6570\u636e\u7c7b\u578b\u3001\u8f93\u5165\u8f93\u51fa\u4e0e\u8fd0\u7b97\u7b26 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6458\u8981&#xff1a;\u672c\u6587\u7cfb\u7edf\u8bb2\u89e3 Python \u7f16\u7a0b\u5165\u95e8\u7684\u57fa\u7840\u77e5\u8bc6&#xff0c;\u6db5\u76d6\u5b57\u9762\u91cf\u4e0e\u53d8\u91cf\u3001\u5e38\u89c1\u6570\u636e\u7c7b\u578b\u3001\u8f93\u5165\u8f93\u51fa\u4ee5\u53ca\u8fd0\u7b97\u7b26\u56db\u5927\u6838\u5fc3\u6a21\u5757\u3002\u5185\u5bb9\u4ece\u5b57\u9762\u91cf\u7684\u4e66\u5199\u683c\u5f0f\u3001\u53d8\u91cf\u7684\u5b9a\u4e49\u4e0e\u4f7f\u7528\u3001\u6807\u8bc6\u7b26\u7684\u547d\u540d\u89c4\u5219\u4e0e\u89c4\u8303&#xff0c;\u5230\u6574\u6570\u3001\u6d6e\u70b9\u6570\u3001\u5b57\u7b26\u4e32\u3001\u5e03\u5c14\u7b49\u57fa\u7840\u6570\u636e\u7c7b\u578b&#xff0c;\u518d\u5230 input() \u8f93\u5165\u3001print() \u8f93\u51fa\u4e0e\u7c7b\u578b\u8f6c\u6362&#xff0c;\u6700\u540e\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u7b97\u672f\u3001\u8d4b\u503c\u3001\u6bd4\u8f83\u548c\u903b\u8f91\u56db\u7c7b\u8fd0\u7b97\u7b26\u7684\u7528\u6cd5&#xff0c;\u5e76\u914d\u6709\u5927\u91cf\u53ef\u8fd0\u884c\u7684\u4ee3\u7801\u793a\u4f8b\u4e0e\u5b9e\u6218\u6848\u4f8b&#xff0c;\u5e2e","og_url":"https:\/\/www.wsisp.com\/helps\/108054.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-20T13:49:11+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"9 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/108054.html","url":"https:\/\/www.wsisp.com\/helps\/108054.html","name":"Python\u57fa\u784002 \u5b57\u9762\u91cf\u3001\u53d8\u91cf\u3001\u6570\u636e\u7c7b\u578b\u3001\u8f93\u5165\u8f93\u51fa\u4e0e\u8fd0\u7b97\u7b26 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-20T13:49:11+00:00","dateModified":"2026-09-20T13:49:11+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/108054.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/108054.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/108054.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Python\u57fa\u784002 \u5b57\u9762\u91cf\u3001\u53d8\u91cf\u3001\u6570\u636e\u7c7b\u578b\u3001\u8f93\u5165\u8f93\u51fa\u4e0e\u8fd0\u7b97\u7b26"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/108054","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=108054"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/108054\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=108054"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=108054"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=108054"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=108054"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}