{"id":59527,"date":"2026-01-14T00:09:18","date_gmt":"2026-01-13T16:09:18","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/59527.html"},"modified":"2026-01-14T00:09:18","modified_gmt":"2026-01-13T16:09:18","slug":"python%e5%9f%ba%e7%a1%80","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/59527.html","title":{"rendered":"python\u57fa\u7840"},"content":{"rendered":"<p>python:pycharm&#xff08;\u7f16\u7a0b&#xff09;,jupyter&#xff08;\u5b66\u6821\u5e38\u7528&#xff09;,idle&#xff08;\u4e0d\u65b9\u4fbf\u5f00\u53d1&#xff09;,vsc&#xff08;c&#043;&#043;&#xff09;<\/p>\n<p>\u8bbe\u7f6e&#xff1a;\u63d2\u4ef6&#xff0c;\u6539\u4e2d\u6587<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"883\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160911-69666e2792848.png\" width=\"1082\" \/><\/p>\n<p>\u8bbe\u7f6e&#xff1a;\u9879\u76ee&#xff1a;python\u89e3\u91ca\u5668&#xff1a;\u4fee\u6539\u89e3\u91ca\u5668<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"581\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160912-69666e2894e93.png\" width=\"690\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"920\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160912-69666e28b38f6.png\" width=\"1245\" \/><\/p>\n<h2>2.1.2\u8282\u51fd\u6570&#xff1a;print&#xff08;&#xff09;\u51fd\u6570<\/h2>\n<p>1.\u53c2\u6570\u4e3a\u5b57\u7b26\u4e32&#xff08;\u7528\u5355\u5f15\u53f7\u6216\u8005\u53cc\u5f15\u53f7\u5f15\u8d77\u6765\u7684\u4fe1\u606f&#xff09;&#xff0c;\u8f93\u51fa\u5b57\u7b26\u4e32\u3002<\/p>\n<p>2.\u53c2\u6570\u4e3a\u53d8\u91cf\u540d&#xff1a;\u5c06\u53d8\u91cf\u8f93\u51fa\u3002<\/p>\n<p>3.\u53c2\u6570\u4e3a\u8868\u8fbe\u5f0f&#xff0c;print&#xff08;&#xff09;\u51fd\u6570\u76f4\u63a5\u5199\u4e3a\u8ba1\u7b97\u8868\u8fbe\u5f0f&#xff0c;\u5c06\u8ba1\u7b97\u7ed3\u679c\u8f93\u51fa\u3002<\/p>\n<p>4.\u53c2\u6570\u4e3a\u591a\u4e2a\u53c2\u6570&#xff0c;print&#xff08;\u53c2\u65701&#xff0c;\u53c2\u65702&#xff0c;&#8230;,\u53c2\u6570n&#xff09;\u51fd\u6570\u4e2d\u7684\u53c2\u6570\u7528\u82f1\u6587\u683c\u5f0f\u7684\u9017\u53f7\u9694\u5f00&#xff0c;\u8f93\u51fa\u65f6\u9017\u53f7\u4f1a\u53d8\u6210\u7a7a\u683c&#xff0c;\u6bcf\u4e2a\u53c2\u6570\u53ef\u4ee5\u662f\u4e0d\u540c\u5f62\u5f0f\u3002<\/p>\n<p>5.\u8f93\u51fa\u672b\u5c3e\u8bbe\u7f6e&#xff0c;\u591a\u4e2aprint&#xff08;&#xff09;\u51fd\u6570\u8f93\u51fa&#xff0c;\u81ea\u52a8\u6362\u884c&#xff0c;\u5982\u679c\u5c06\u4e24\u4e2aprint()\u51fd\u6570\u8fde\u5728\u4e00\u8d77&#xff0c;\u53ef\u4ee5\u5728\u7b2c\u4e00\u4e2aprint()\u51fd\u6570\u4e2d\u589e\u52a0\u4e00\u4e2a\u53c2\u6570end\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"277\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160913-69666e293d683.png\" width=\"841\" \/><\/p>\n<p>&#xff08;1&#xff09;.__builtins__<br \/>\nPython \u5185\u7f6e\u6a21\u5757&#xff0c;\u5305\u542b\u6240\u6709\u5185\u7f6e\u51fd\u6570\u3001\u5f02\u5e38\u548c\u7c7b\u578b\u7684\u540d\u79f0&#xff08;\u5982 print()\u3001int\u3001Exception \u7b49&#xff09;\u3002\u901a\u5e38\u65e0\u9700\u663e\u5f0f\u5bfc\u5165\u5373\u53ef\u4f7f\u7528\u3002<br \/>\n&#xff08;2&#xff09;. dir() \u51fd\u6570<br \/>\n\u8fd4\u56de\u5bf9\u8c61\u7684\u6709\u6548\u5c5e\u6027\u5217\u8868\u3002\u5bf9 __builtins__ \u4f7f\u7528 dir() \u4f1a\u5217\u51fa\u5f53\u524d Python \u73af\u5883\u4e2d\u6240\u6709\u53ef\u7528\u7684\u5185\u7f6e\u540d\u79f0\u3002<\/p>\n<p><span style=\"color:#fe2c24\">\u53c2\u6570\u4e3a\u51fd\u6570\u7684\u65f6\u5019&#xff0c;\u5148\u5c06\u51fd\u6570\u6267\u884c\u7ed3\u675f&#xff0c;\u5c06\u51fd\u6570\u7684\u7ed3\u679c\u6253\u5370\u3002<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"675\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160913-69666e296b653.png\" width=\"1119\" \/><\/p>\n<h2>2.2\u8282\u5143\u7d20\u540d\u79f0\u547d\u540d&#xff08;\u53d8\u91cf&#xff0c;\u51fd\u6570&#xff0c;\u7c7b&#xff09;<\/h2>\n<h3 style=\"background-color:transparent\">2.2.1\u53d8\u91cf\u540d\u7684\u547d\u540d\u89c4\u5219&#xff08;4\u6761\u89c4\u5219&#xff09;<\/h3>\n<p>1.\u5927\u5c0f\u5199\u5b57\u6bcd&#xff0c;\u6570\u5b57&#xff0c;\u4e0b\u5212\u7ebf&#xff0c;\u6c49\u5b57\u4ee5\u53ca\u5b83\u4eec\u7684\u7ec4\u5408\u8fdb\u884c\u547d\u540d<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"492\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160914-69666e2a225bc.png\" width=\"578\" \/><\/p>\n<p><span style=\"color:#fe2c24\">&#064;\u4e0d\u5728\u5927\u5c0f\u5199\u5b57\u6bcd&#xff0c;\u6570\u5b57&#xff0c;\u4e0b\u5212\u7ebf&#xff0c;\u6c49\u5b57\u4e4b\u5185<\/span><\/p>\n<p>2.\u53d8\u91cf\u540d\u4e0d\u80fd\u6570\u5b57\u5f00\u5934&#xff0c;\u53d8\u91cf\u540d\u4e2d\u95f4\u4e0d\u80fd\u6709\u7a7a\u683c<\/p>\n<p>3.\u53d8\u91cf\u547d\u4e0d\u80fd\u548c\u4fdd\u7559\u5b57&#xff08;\u5173\u952e\u8bcd&#xff09;\u76f8\u540c<\/p>\n<p>\u4fdd\u7559\u5b57\u662f\u7f16\u7a0b\u8bed\u8a00\u5185\u90e8\u5df2\u88ab\u4f7f\u7528\u7684\u5177\u6709\u7279\u5b9a\u529f\u80fd\u7684\u540d\u79f0&#xff0c;\u53ef\u4ee5\u7528print&#xff08;help&#xff08;&#039;keywords&#039;&#xff09;&#xff09;\u4ee3\u7801\u67e5\u8be2\u5168\u90e8\u7684\u4fdd\u7559\u5b57<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"537\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160914-69666e2a5e260.png\" width=\"781\" \/><\/p>\n<p>4.\u53d8\u91cf\u540d\u5c3d\u91cf\u4e0d\u8981\u4e0ePython\u5185\u7f6e\u51fd\u6570\u540d\u76f8\u540c<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"562\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160915-69666e2b32399.png\" width=\"811\" \/><\/p>\n<p>print\u4e0d\u518d\u662f\u51fd\u6570&#xff0c;\u76f8\u5f53\u4e8e\u4e00\u4e2a\u53d8\u91cf&#xff0c;\u5931\u53bb\u539f\u6765\u51fd\u6570\u7684\u4f5c\u7528\u4e86<\/p>\n<h3>2.2.2\u8d4b\u503c\u8bed\u53e5<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"371\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160915-69666e2bbb7c8.png\" width=\"976\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"435\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160916-69666e2c08404.jpg\" width=\"792\" \/><\/p>\n<p>python\u4e25\u683c\u533a\u5206\u5927\u5c0f\u5199&#xff0c;\u5927\u5199Else\u4e0eelse\u4e0d\u4e00\u6837&#xff0c;Python\u662f\u533a\u5206\u5927\u5c0f\u5199\u7684\u7f16\u7a0b\u8bed\u8a00&#xff0c;else\u662f\u5408\u6cd5\u7684\u5173\u952e\u5b57&#xff0c;\u7528\u4e8e\u6761\u4ef6\u8bed\u53e5&#xff08;\u5982if-else&#xff09;\u6216\u5faa\u73af\u8bed\u53e5&#xff08;\u5982for-else\u3001while-else&#xff09;\u3002\u800cElse\u7531\u4e8e\u9996\u5b57\u6bcd\u5927\u5199&#xff0c;\u4f1a\u88ab\u89c6\u4e3a\u666e\u901a\u6807\u8bc6\u7b26\u800c\u975e\u5173\u952e\u5b57&#xff0c;\u76f4\u63a5\u4f7f\u7528\u4f1a\u5bfc\u81f4\u8bed\u6cd5\u9519\u8bef\u3002<\/p>\n<p>\u5185\u5b58\u6761\u4e0e\u786c\u76d8\u4e25\u683c\u533a\u5206\u5f00&#xff1a;\u786c\u76d8&#xff08;HDD\/SSD&#xff09;\u901a\u5e38\u4ee5TB\u4e3a\u5355\u4f4d&#xff08;1TB&#061;1024GB&#xff09;&#xff0c;\u5185\u5b58\u6761&#xff08;RAM&#xff09;\u4ee5GB\u4e3a\u5355\u4f4d&#xff08;\u5e38\u89c18GB-64GB&#xff09;<\/p>\n<p>\u591a\u4e2a\u53d8\u91cf\u540c\u65f6\u8d4b\u503c&#xff1a;<\/p>\n<p>\u53d8\u91cf1&#xff0c;\u53d8\u91cf2&#xff0c;&#8230;&#061;\u6570\u636e1&#xff0c;\u6570\u636e2&#xff0c;&#8230;<\/p>\n<h2 style=\"background-color:transparent\">2.3\u57fa\u672c\u6570\u636e\u7c7b\u578b<\/h2>\n<p style=\"background-color:transparent\">&#xff08;\u6bcf\u4e00\u79cd\u6570\u636e\u7c7b\u578b&#xff1f;\u6bcf\u4e00\u79cd\u6570\u636e\u90fd\u6709\u5404\u81ea\u64cd\u4f5c\u65b9\u6cd5&#xff1f;&#xff09;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"352\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160916-69666e2c23720.png\" width=\"497\" \/><\/p>\n<h3>2.3.1\u6570\u636e\u7c7b\u578b\u4ecb\u7ecd<\/h3>\n<p>\u6570\u503c\u7c7b\u578b:\u6574\u6570&#xff0c;\u6d6e\u70b9\u6570&#xff0c;\u590d\u6570\u7c7b\u578b<\/p>\n<p>\u64cd\u4f5c\u7b26&#xff1a;&#043;\u00a0 &#8211;\u00a0 *\u00a0 %&#xff08;\u6c42\u4f59\u6570&#xff09;\u00a0 \/\u00a0 \/\/&#xff08;\u6574\u9664&#xff09;\u00a0 **&#xff08;\u6c42\u6b21\u5e42&#xff09;<\/p>\n<p>\u64cd\u4f5c\u7b26\u53ef\u4ee5\u4e0e\u8d4b\u503c\u8bed\u53e5\u7ed3\u5408<\/p>\n<p>\u589e\u5f3a\u8d4b\u503c\u64cd\u4f5c\u7b26&#xff1a;\u8d4b\u503c\u8bed\u53e5\u4e2d\u7684\u7b49\u53f7\u548c\u64cd\u4f5c\u7b26\u7ed3\u5408\u5728\u4e00\u8d77&#xff0c;\u4e2d\u95f4\u6ca1\u6709\u7a7a\u683c<\/p>\n<p>\u5e38\u89c1\u589e\u5f3a\u64cd\u4f5c\u7b26&#xff1a;&#043;&#061;&#xff0c;-&#061;,*&#061;,\/&#061;,\/\/&#061;,%&#061;&#xff0c;**&#061;&#xff0c;\u5c06a\u8d4b\u503c\u4e3a2&#xff0c;\u5219a&#043;&#061;3\u7b49\u4ef7\u4e8ea&#061;a&#043;3&#xff0c;\u7ed3\u679c\u4e3a5,\u540c\u7406a-&#061;3&#xff0c;\u7ed3\u679c\u4e3a-1&#xff0c;a*&#061;3&#xff0c;\u7ed3\u679c\u4e3a6&#xff0c;a\/&#061;3,\u7ed3\u679c\u4e3a2&#xff0c;a\/\/&#061;3,\u7ed3\u679c\u4e3a0&#xff0c;a%&#061;3&#xff0c;\u7ed3\u679c\u4e3a2&#xff0c;a**&#061;3\u7ed3\u679c\u4e3a8<\/p>\n<p>\u5b57\u7b26\u4e32\u7c7b\u578b<\/p>\n<p>\u5b57\u7b26\u4e32\u4e00\u5b9a\u8981\u7528\u5f15\u53f7\u5f15\u8d77\u6765&#xff1a;\u5355\u5f15\u53f7&#xff0c;\u53cc\u5f15\u53f7<\/p>\n<p>&#039;&#039;&#039; &#039;&#039;&#039;\u591a\u884c\u5b57\u7b26\u4e32<\/p>\n<p>\u5b57\u7b26\u4e32\u7d22\u5f15&#xff1a;\u83b7\u53d6\u5b57\u7b26\u4e32\u7684\u5185\u5bb9&#xff0c;\u4e00\u4e2a\u5b57\u7b26&#xff0c;\u5b57\u7b26\u4e32[\u7d22\u5f15\u53f7]<\/p>\n<p>\u5b57\u7b26\u4e32\u5207\u7247&#xff1a;\u83b7\u53d6\u4e00\u4e2a\u6216\u8005\u591a\u4e2a\u5b57\u7b26&#xff0c;\u5b57\u7b26\u4e32[\u4e0b\u68071&#xff1a;\u4e0b\u68072],\u6b65\u957f\u5207\u7247[\u4e0b\u68071&#xff1a;\u4e0b\u68072&#xff1a;\u6b65\u957f]<\/p>\n<p>\u6b65\u957f&#xff1a;\u4e0b\u68071\u5230\u4e0b\u68072\u7684\u5b57\u7b26\u4e32\u4e2d&#xff0c;\u6bcf\u9694\u201c\u6b65\u957f\u201d\u4e2a\u4f4d\u7f6e\u5c31\u622a\u53d6\u4e00\u4e2a\u5b57\u7b26\u4fe1\u606f\u3002<\/p>\n<p>\u65b9\u5411&#xff1a;\u4e0b\u6807\u6b63\u6570&#xff0c;\u4ece\u5de6\u5f80\u53f3\u8d70,\u7d22\u5f15\u53f70&#xff0c;1,2,3,4,5&#xff1b;\u4e0b\u6807\u8d1f\u6570&#xff0c;\u4ece\u53f3\u5f80\u5de6\u7d22\u5f15\u53f7&#xff1a;-6&#xff0c;-5&#xff0c;-4&#xff0c;-3&#xff0c;-2&#xff0c;-1,<\/p>\n<p>\u5b57\u7b26\u4e32\u51fd\u6570<\/p>\n<p>len&#xff08;\u53c2\u6570&#xff09;<\/p>\n<p>\u529f\u80fd&#xff1a;\u7528\u4e8e\u6d4b\u91cf\u53c2\u6570\u7684\u957f\u5ea6&#xff0c;\u6216\u8005\u7edf\u8ba1\u5b57\u7b26\u4e32\u7684\u4e2a\u6570\u3002<\/p>\n<p>\u5b57\u7b26\u4e32\u65b9\u6cd5<\/p>\n<\/p>\n<p>\u6570\u636e.\u65b9\u6cd5\u540d&#xff08;\u53c2\u6570&#xff09;<\/p>\n<p>&#xff08;1&#xff09;str.count(\u53c2\u65701)\u529f\u80fd&#xff1a;\u7edf\u8ba1\u5b57\u7b26\u4e32str\u4e2d\u53c2\u6570\u51fa\u73b0\u7684\u6b21\u6570<\/p>\n<p>&#xff08;2&#xff09;str.replace(\u53c2\u65701&#xff0c;\u53c2\u65702) \u529f\u80fd&#xff1a;\u5c06\u53c2\u65701\u5185\u5bb9\u66ff\u6362\u6210\u53c2\u65702<\/p>\n<p>&#xff08;3&#xff09;str.strip(\u53c2\u6570)\u529f\u80fd&#xff1a;\u5224\u65adstr\u5b57\u7b26\u4e32\u4e2d\u5f00\u5934\u548c\u7ed3\u5c3e\u7684\u5b57\u7b26\u662f\u5426\u76f8\u540c&#xff0c;\u82e5\u76f8\u540c\u5219\u5220\u9664\u4e0e\u53c2\u6570\u76f8\u540c\u7684\u5b57\u7b26\u3002<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"446\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160916-69666e2c3686a.png\" width=\"1214\" \/><\/p>\n<p>\u00a0 (4)\u00a0 \u00a0str.split(\u53c2\u6570)\u529f\u80fd&#xff1a;\u5c06\u5b57\u7b26\u4e32str\u5728\u53c2\u6570\u6240\u6307\u4f4d\u7f6e\u5904\u8fdb\u884c\u5206\u9694\u5e76\u7ec4\u6210\u4e00\u4e2a\u5217\u8868<\/p>\n<p>&#xff08;5&#xff09;str.join(\u53c2\u6570&#xff09;\u5728\u53c2\u6570\u7684\u6bcf\u4e24\u4e2a\u5b57\u7b26\u4e4b\u95f4\u52a0\u5165\u5b57\u7b26\u4e32str<\/p>\n<p>\u00a0 (6)\u00a0 \u00a0str.format()&#034;\u5b57\u7b26{}\u5b57\u7b26{}&#8230;&#039;&#039;.format&#xff08;\u53c2\u65701&#xff0c;\u53c2\u65702&#xff09;<\/p>\n<p>\u529f\u80fd&#xff1a;\u5b57\u7b26\u4e32\u4e2d\u7684{}\u8868\u793a\u69fd&#xff0c;\u69fd\u7528\u4e8e\u66ff\u6362format()\u7684\u62ec\u53f7\u4e2d\u7684\u53c2\u6570<\/p>\n<p>\u8f6c\u4e49\u5b57\u7b26(\u5236\u8868\u7b26&#xff0c;\u6362\u884c\u7b26&#xff0c;\u6362\u9875\u7b26&#xff0c;\u5f15\u53f7&#xff09;<\/p>\n<p>\\\\n<br \/>\n\u6362\u884c\u7b26&#xff0c;\u7528\u4e8e\u5728\u5b57\u7b26\u4e32\u4e2d\u521b\u5efa\u65b0\u7684\u4e00\u884c\u3002<br \/>\n\\\\t<br \/>\n\u6c34\u5e73\u5236\u8868\u7b26&#xff0c;\u7528\u4e8e\u5728\u5b57\u7b26\u4e32\u4e2d\u63d2\u5165\u4e00\u4e2a\u5236\u8868\u7b26&#xff08;\u901a\u5e38\u76f8\u5f53\u4e8e4\u4e2a\u62168\u4e2a\u7a7a\u683c&#xff09;\u3002<br \/>\n\\\\\\\\<br \/>\n\u53cd\u659c\u6760&#xff0c;\u7528\u4e8e\u5728\u5b57\u7b26\u4e32\u4e2d\u8868\u793a\u4e00\u4e2a\u5b9e\u9645\u7684\u53cd\u659c\u6760\u5b57\u7b26\u3002<br \/>\n\\\\&#039;<br \/>\n\u5355\u5f15\u53f7&#xff0c;\u7528\u4e8e\u5728\u5355\u5f15\u53f7\u5b57\u7b26\u4e32\u4e2d\u8868\u793a\u4e00\u4e2a\u5355\u5f15\u53f7\u5b57\u7b26\u3002<br \/>\n\\\\&#034;<br \/>\n\u53cc\u5f15\u53f7&#xff0c;\u7528\u4e8e\u5728\u53cc\u5f15\u53f7\u5b57\u7b26\u4e32\u4e2d\u8868\u793a\u4e00\u4e2a\u53cc\u5f15\u53f7\u5b57\u7b26\u3002<br \/>\n\\\\r<br \/>\n\u56de\u8f66\u7b26&#xff0c;\u5c06\u5149\u6807\u79fb\u52a8\u5230\u5f53\u524d\u884c\u7684\u5f00\u5934\u3002<br \/>\n\\\\b<br \/>\n\u9000\u683c\u7b26&#xff0c;\u5220\u9664\u524d\u4e00\u4e2a\u5b57\u7b26\u3002<br \/>\n\\\\f<br \/>\n\u6362\u9875\u7b26&#xff0c;\u7528\u4e8e\u63a7\u5236\u6253\u5370\u673a\u7684\u6362\u9875\u64cd\u4f5c\u3002<\/p>\n<p><span style=\"color:#fe2c24\">\u7531\u4e8e\\\\\u4f1a\u88ab\u8f6c\u4e49\u4e3a\u7279\u6b8a\u5b57\u7b26&#xff0c;\u6240\u4ee5\u5b57\u7b26\u4e32\u4e2d\u7684\\\\\u7528\\\\\\\\\u8868\u793a<\/span><\/p>\n<p>r:\u8868\u793a\u8be5\u5b57\u7b26\u4e32\u4e3a\u539f\u59cb\u5b57\u7b26\u4e32&#xff0c;\u539f\u59cb\u5b57\u7b26\u4e32\u4f1a\u5ffd\u7565\u8f6c\u4e49\u5b57\u7b26&#xff08;\u5982\\\\n\u3001\\\\t\u7b49&#xff09;&#xff0c;\u4e0d\u505a\u8f6c\u4e49<\/p>\n<h3>2.3.2\u83b7\u53d6\u6570\u636e\u7c7b\u578b<\/h3>\n<p>type(\u6570\u636e):\u76d1\u6d4b\u6570\u636e\u7c7b\u578b<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"291\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160916-69666e2c67abc.png\" width=\"681\" \/><\/p>\n<p>&lt;class &#039;str&#039;&gt;\u00a0 \u00a0str\u8868\u793a\u5b57\u7b26\u4e32\u7c7b\u578b<\/p>\n<p>&lt;class &#039;int&#039;&gt;\u00a0 \u00a0int\u8868\u793a\u6574\u6570\u7c7b\u578b<\/p>\n<p>&lt;class &#039;float&#039;&gt; float\u8868\u793a\u6d6e\u70b9\u6570\u7c7b\u578b<\/p>\n<p>&lt;class &#039;list&#039;&gt;\u00a0 \u00a0list\u8868\u793a\u5217\u8868\u7c7b\u578b<\/p>\n<h3>2.3.3\u5f3a\u5236\u8f6c\u6362\u6570\u636e\u7c7b\u578b<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"273\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160916-69666e2c74e67.png\" width=\"670\" \/><\/h3>\n<p>\u53d8\u91cfa&#xff1a;\u521d\u59cb\u503c\u4e3a\u5b57\u7b26\u4e32&#034;31415&#034;&#xff0c;\u901a\u8fc7type(a)\u8f93\u51fa\u4e3a&lt;class &#039;str&#039;&gt;<br \/>\n\u53d8\u91cfb&#xff1a;\u901a\u8fc7int(a)\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u6574\u6570&#xff0c;\u503c\u4e3a31415&#xff0c;\u7c7b\u578b\u4e3a&lt;class &#039;int&#039;&gt;<br \/>\n\u53d8\u91cfc&#xff1a;\u76f4\u63a5\u8d4b\u503c\u4e3a\u6d6e\u70b9\u65701.717&#xff0c;\u7c7b\u578b\u4e3a&lt;class &#039;float&#039;&gt;<br \/>\n\u53d8\u91cfd&#xff1a;\u901a\u8fc7str(c)\u5c06\u6d6e\u70b9\u6570\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32&#xff0c;\u503c\u4e3a&#034;1.717&#034;&#xff0c;\u7c7b\u578b\u4e3a&lt;class &#039;str&#039;&gt;<\/p>\n<ul>\n<li>\u5b57\u7b26\u4e32\u8f6c\u6574\u6570\u65f6\u9700\u786e\u4fdd\u5b57\u7b26\u4e32\u5185\u5bb9\u4e3a\u6709\u6548\u6570\u5b57\u683c\u5f0f<\/li>\n<li>\u6d6e\u70b9\u6570\u8f6c\u5b57\u7b26\u4e32\u4f1a\u4fdd\u7559\u539f\u59cb\u7cbe\u5ea6<\/li>\n<li>\u7c7b\u578b\u8f6c\u6362\u51fd\u6570&#xff08;int(),float(),str()&#xff09;\u662fPython\u57fa\u7840\u7c7b\u578b\u8f6c\u6362\u65b9\u6cd5<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"307\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160916-69666e2c82187.png\" width=\"901\" \/><\/li>\n<li>\u5b57\u7b26\u4e32 &#034;3.1415&#034; \u5305\u542b\u5c0f\u6570\u70b9&#xff0c;\u76f4\u63a5\u4f7f\u7528 int() \u8f6c\u6362\u4f1a\u5f15\u53d1 ValueError\u3002int() \u53ea\u80fd\u8f6c\u6362\u7eaf\u6574\u6570\u5b57\u7b26\u4e32&#xff08;\u5982 &#034;42&#034;&#xff09;\u6216\u6d6e\u70b9\u6570&#xff08;\u5982 3.1415 \u9700\u5148\u8f6c\u6362\u4e3a\u6d6e\u70b9\u518d\u53d6\u6574&#xff09;<\/li>\n<\/ul>\n<p>\u5c06\u5b57\u7b26\u4e32\u5148\u8f6c\u6362\u4e3a\u6d6e\u70b9\u6570&#xff0c;\u518d\u8f6c\u4e3a\u6574\u6570&#xff1a;<\/p>\n<p>a &#061; &#034;3.1415&#034;<br \/>\nb &#061; int(float(a)) \u00a0# \u5148\u8f6c\u6d6e\u70b9\u518d\u8f6c\u6574\u578b<br \/>\nprint(type(a), type(b)) \u00a0# \u8f93\u51fa: &lt;class &#039;str&#039;&gt; &lt;class &#039;int&#039;&gt;<\/p>\n<ul>\n<li>type(a)\u00a0\u663e\u793a\u00a0&lt;class &#039;str&#039;&gt;&#xff0c;\u56e0\u4e3a\u00a0a\u00a0\u662f\u539f\u59cb\u5b57\u7b26\u4e32\u3002<\/li>\n<li>type(b)\u00a0\u663e\u793a\u00a0&lt;class &#039;int&#039;&gt;&#xff0c;\u901a\u8fc7\u4e24\u6b65\u8f6c\u6362\u540e\u5f97\u5230\u6574\u6570\u90e8\u5206\u00a03\u3002<\/li>\n<\/ul>\n<h3>2.3.4\u62a5\u9519\u4fe1\u606f\u5206\u6790<\/h3>\n<p>\u8bed\u6cd5\u9519\u8bef&#xff08;SyntaxError&#xff09;&#xff1a;\u4ee3\u7801\u4e0d\u7b26\u5408Python\u8bed\u6cd5\u89c4\u5219&#xff0c;\u901a\u5e38\u5728\u8fd0\u884c\u524d\u88ab\u89e3\u91ca\u5668\u6355\u83b7\u3002\u9519\u8bef\u4fe1\u606f\u4f1a\u6307\u51fa\u5177\u4f53\u884c\u53f7\u548c\u95ee\u9898\u4f4d\u7f6e\u3002<\/p>\n<p>\u540d\u79f0\u9519\u8bef&#xff08;NameError&#xff09;&#xff1a;\u5c1d\u8bd5\u8bbf\u95ee\u672a\u5b9a\u4e49\u7684\u53d8\u91cf\u6216\u51fd\u6570\u3002\u68c0\u67e5\u62fc\u5199\u9519\u8bef\u6216\u53d8\u91cf\u4f5c\u7528\u57df\u3002<\/p>\n<p>\u7c7b\u578b\u9519\u8bef&#xff08;TypeError&#xff09;&#xff1a;\u64cd\u4f5c\u6216\u51fd\u6570\u5e94\u7528\u4e8e\u4e0d\u517c\u5bb9\u7c7b\u578b\u7684\u5bf9\u8c61\u3002<\/p>\n<p>\u7d22\u5f15\u9519\u8bef&#xff08;IndexError&#xff09;&#xff1a;\u5c1d\u8bd5\u8bbf\u95ee\u5e8f\u5217&#xff08;\u5982\u5217\u8868\u3001\u5b57\u7b26\u4e32&#xff09;\u4e2d\u4e0d\u5b58\u5728\u7684\u7d22\u5f15\u3002<\/p>\n<p>\u5c5e\u6027\u9519\u8bef&#xff08;AttributeError&#xff09;:\u5bf9\u8c61\u6ca1\u6709\u5c1d\u8bd5\u8bbf\u95ee\u7684\u5c5e\u6027\u6216\u65b9\u6cd5\u3002<br \/>\n\u952e\u9519\u8bef&#xff08;KeyError&#xff09;:\u5b57\u5178\u4e2d\u8bbf\u95ee\u4e0d\u5b58\u5728\u7684\u952e\u3002<\/p>\n<p>\u5bfc\u5165\u9519\u8bef&#xff08;ImportError&#xff09;:\u5bfc\u5165\u6a21\u5757\u6216\u6a21\u5757\u4e2d\u7279\u5b9a\u540d\u79f0\u5931\u8d25\u3002<\/p>\n<p>\u7f29\u8fdb\u9519\u8bef&#xff08;IndentationError&#xff09;:\u4ee3\u7801\u5757\u7f29\u8fdb\u4e0d\u6b63\u786e\u3002<\/p>\n<p>\u6587\u4ef6\u672a\u627e\u5230\u9519\u8bef&#xff08;FileNotFoundError&#xff09;:\u5c1d\u8bd5\u6253\u5f00\u4e0d\u5b58\u5728\u7684\u6587\u4ef6\u3002<\/p>\n<p>\u503c\u9519\u8bef&#xff08;ValueError&#xff09;:\u51fd\u6570\u63a5\u6536\u5230\u6b63\u786e\u7c7b\u578b\u4f46\u65e0\u6548\u7684\u503c\u3002<\/p>\n<h3>2.3.5\u591a\u884c\u5904\u7406<\/h3>\n<p>\u4ee3\u7801\u592a\u957f\u9700\u8981\u5199\u6210\u591a\u884c\u65f6&#xff0c;\u53ef\u4ee5\u5728\u9700\u8981\u6362\u884c\u7684\u4ee3\u7801\u672b\u5c3e\u6dfb\u52a0\u4e00\u4e2a\\\\<\/p>\n<p>\u5982\u4e0b\u4ee3\u7801&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"292\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160916-69666e2c9a411.png\" width=\"557\" \/><\/p>\n<\/p>\n<h2>2.4\u8f93\u5165\u51fd\u6570input&#xff08;&#xff09;<\/h2>\n<p>input(\u63d0\u793a\u4fe1\u606f&#xff09;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"276\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160916-69666e2ca7d64.png\" width=\"486\" \/><\/p>\n<p>\u4f7f\u7528input\u51fd\u6570\u83b7\u53d6\u7528\u6237\u8f93\u5165\u7684\u8d26\u5355\u53f7&#xff0c;\u5e76\u5c06\u8f93\u5165\u503c\u8d4b\u7ed9\u53d8\u91cfa\u3002\u63d0\u793a\u4fe1\u606f&#034;\u8bf7\u5728\u6b64\u5904\u8f93\u5165\u4e00\u4e2a\u8d26\u5355\u53f7&#xff1a;&#034;\u4f1a\u663e\u793a\u5728\u63a7\u5236\u53f0\u3002&#034;<\/p>\n<p>print(&#034;\u6b63\u5728\u67e5\u8be2&#034;,a,&#034;&#8230;&#034;,&#039;\\\\n\u67e5\u8be2\u6210\u529f!&#039;)<br \/>\n\u8f93\u51fa\u67e5\u8be2\u72b6\u6001\u4fe1\u606f&#xff1a;<br \/>\n\u25e6 \u663e\u793a\u5f53\u524d\u6b63\u5728\u67e5\u8be2\u7684\u8d26\u5355\u53f7&#xff08;\u53d8\u91cfa\u7684\u503c&#xff09;<br \/>\n\u25e6 \u6dfb\u52a0\u7701\u7565\u53f7\u8868\u793a\u67e5\u8be2\u4e2d<br \/>\n\u25e6 \u6362\u884c\u540e\u8f93\u51fa&#034;\u67e5\u8be2\u6210\u529f!&#034;\u4f5c\u4e3a\u7ed3\u679c\u63d0\u793a<\/p>\n<p>\u6279\u91cf\u6ce8\u91ca&#xff1a;ctrl&#043;\/<\/p>\n<h2>3.\u7a0b\u5e8f\u63a7\u5236\u8bed\u53e5<\/h2>\n<h3>3.1.1if\u8bed\u53e5<\/h3>\n<p>Python\u4e2d\u7684if\u8bed\u53e5\u7528\u4e8e\u6761\u4ef6\u5224\u65ad&#xff0c;\u6839\u636e\u6761\u4ef6\u7684\u771f\u5047\u6267\u884c\u4e0d\u540c\u7684\u4ee3\u7801\u5757\u3002\u57fa\u672c\u8bed\u6cd5\u5982\u4e0b&#xff1a;<\/p>\n<p>if \u6761\u4ef6:<br \/>\n\u00a0 \u00a0 # \u6761\u4ef6\u4e3a\u771f\u65f6\u6267\u884c\u7684\u4ee3\u7801<br \/>\n\u6761\u4ef6\u53ef\u4ee5\u662f\u4efb\u4f55\u8fd4\u56de\u5e03\u5c14\u503c&#xff08;True\u6216False&#xff09;\u7684\u8868\u8fbe\u5f0f\u3002\u82e5\u6761\u4ef6\u4e3aTrue&#xff0c;\u5219\u6267\u884c\u7f29\u8fdb\u5757\u5185\u7684\u4ee3\u7801&#xff1b;\u5426\u5219\u8df3\u8fc7\u3002<\/p>\n<h2><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"818\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160916-69666e2cb5788.png\" width=\"1112\" \/><\/h2>\n<h3>3.1.2\u5e03\u5c14\u503c<\/h3>\n<p>\u53ea\u6709ture\u548cflase\u4e24\u79cd<\/p>\n<h3>3.1.3if&#043;else\u8bed\u53e5<\/h3>\n<\/p>\n<p>\u5f53\u9700\u8981\u5904\u7406\u6761\u4ef6\u4e0d\u6210\u7acb\u7684\u60c5\u51b5\u65f6&#xff0c;\u4f7f\u7528if-else\u7ed3\u6784&#xff1a;<\/p>\n<p>if \u6761\u4ef6:<br \/>\n\u00a0 \u00a0 # \u6761\u4ef6\u4e3a\u771f\u65f6\u6267\u884c\u7684\u4ee3\u7801<br \/>\nelse:<br \/>\n\u00a0 \u00a0 # \u6761\u4ef6\u4e3a\u5047\u65f6\u6267\u884c\u7684\u4ee3\u7801<br \/>\n\u00a0<\/p>\n<h3>3.1.4if&#043;elif&#043;else\u8bed\u53e5<\/h3>\n<p>\u5bf9\u4e8e\u591a\u6761\u4ef6\u5224\u65ad&#xff0c;\u4f7f\u7528if-elif-else\u7ed3\u6784&#xff1a;<\/p>\n<p>if \u6761\u4ef61:<br \/>\n\u00a0 \u00a0 # \u6761\u4ef61\u4e3a\u771f\u65f6\u6267\u884c<br \/>\nelif \u6761\u4ef62:<br \/>\n\u00a0 \u00a0 # \u6761\u4ef62\u4e3a\u771f\u65f6\u6267\u884c<br \/>\nelse:<br \/>\n\u00a0 \u00a0 # \u6240\u6709\u6761\u4ef6\u5747\u4e0d\u6ee1\u8db3\u65f6\u6267\u884c<\/p>\n<p>elif&#xff08;\u5373\u201celse if\u201d&#xff09;\u5141\u8bb8\u68c0\u67e5\u591a\u4e2a\u6761\u4ef6&#xff0c;\u6309\u987a\u5e8f\u6267\u884c\u7b2c\u4e00\u4e2a\u4e3aTrue\u7684\u4ee3\u7801\u5757\u3002<\/p>\n<h3>3.1.5\u591a\u4e2aelif\u8bed\u53e5<\/h3>\n<p>\u5728\u7f16\u7a0b\u4e2d&#xff0c;elif\u662felse if\u7684\u7f29\u5199&#xff0c;\u7528\u4e8e\u5728if\u8bed\u53e5\u4e2d\u68c0\u67e5\u591a\u4e2a\u6761\u4ef6\u3002\u5f53\u7b2c\u4e00\u4e2aif\u6761\u4ef6\u4e0d\u6ee1\u8db3\u65f6&#xff0c;\u7a0b\u5e8f\u4f1a\u4f9d\u6b21\u68c0\u67e5\u540e\u7eed\u7684elif\u6761\u4ef6&#xff0c;\u76f4\u5230\u627e\u5230\u6ee1\u8db3\u7684\u6761\u4ef6\u6216\u6267\u884celse\u5757\u3002<\/p>\n<p>\u57fa\u672c\u8bed\u6cd5&#xff1a;if condition1:<br \/>\n\u00a0 \u00a0 # \u6267\u884c\u6761\u4ef61\u6ee1\u8db3\u65f6\u7684\u4ee3\u7801<br \/>\nelif condition2:<br \/>\n\u00a0 \u00a0 # \u6267\u884c\u6761\u4ef62\u6ee1\u8db3\u65f6\u7684\u4ee3\u7801<br \/>\nelif condition3:<br \/>\n\u00a0 \u00a0 # \u6267\u884c\u6761\u4ef63\u6ee1\u8db3\u65f6\u7684\u4ee3\u7801<br \/>\nelse:\u00a0<\/p>\n<p>\u00a0 \u00a0 # \u6240\u6709\u6761\u4ef6\u5747\u4e0d\u6ee1\u8db3\u65f6\u6267\u884c\u7684\u4ee3\u7801<\/p>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u6839\u636e\u5206\u6570\u5224\u65ad\u7b49\u7ea7\u7684\u793a\u4f8b&#xff1a;<br \/>\n\u00a0 \u00a0\u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"496\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160917-69666e2d3cae9.png\" width=\"326\" \/><br \/>\n\u00a0<\/p>\n<h3>3.1.6\u6761\u4ef6\u5224\u65ad\u8bed\u53e5\u7684\u5d4c\u5957<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"534\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160917-69666e2d6a19b.png\" width=\"500\" \/><\/h3>\n<p>if\u8bed\u53e5\u4e2d\u53c8\u5d4c\u5957\u4e86\u4e00\u4e2aif\u8bed\u53e5&#xff0c;\u5d4c\u5957\u8bed\u53e5\u4ee3\u7801\u5757\u9700\u8981\u6574\u4f53\u7f29\u8fdb\u3002\u5bf9\u4e8e\u591a\u91cd\u5d4c\u5957&#xff0c;\u6bcf\u4e00\u5c42\u90fd\u5e94\u5728\u4e0a\u4e00\u5c42\u7684\u7f29\u8fdb\u57fa\u7840\u4e0a\u518d\u7f29\u8fdb\u4e00\u7ea7&#xff0c;\u901a\u5e38\u4f7f\u75284\u4e2a\u7a7a\u683c\u62161\u4e2a\u5236\u8868\u7b26&#xff08;Tab&#xff09;\u4f5c\u4e3a\u4e00\u7ea7\u7f29\u8fdb\u3002\u8d85\u8fc7\u4e09\u5c42\u5d4c\u5957\u65f6\u5e94\u8003\u8651\u91cd\u6784\u4ee3\u7801\u3002<\/p>\n<h3>3.1.7\u591a\u4e2a\u6761\u4ef6\u5224\u65ad\u8bed\u53e5<\/h3>\n<p>\u4e00\u6b21\u5224\u65ad\u591a\u4e2a\u6761\u4ef6\u65f6&#xff0c;\u53ef\u4ee5\u7528\u4fdd\u7559\u5b57and\u548cor<\/p>\n<p>\u6761\u4ef6A and \u6761\u4ef6B&#8230;<\/p>\n<p>\u6761\u4ef6A or \u6761\u4ef6B&#8230;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"380\" src=\"2026-01-14me5rfqcky1u.png\" width=\"550\" \/><\/p>\n<\/p>\n<h3>3.1.8if&#043;else\u8bed\u53e5\u7684\u590d\u5408\u5199\u6cd5<\/h3>\n<p>\u8868\u8fbe\u5f0f1 if \u6761\u4ef6\u5224\u65ad\u8bed\u53e5 else \u8868\u8fbe\u5f0f2<\/p>\n<p>\u82e5\u6761\u4ef6\u5224\u65ad\u53e5\u6ee1\u8db3&#xff0c;\u6267\u884c\u8868\u8fbe\u5f0f1&#xff0c;\u5426\u5219\u6267\u884c\u8868\u8fbe\u5f0f2<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"326\" src=\"2026-01-14um44kkcamo4.png\" width=\"382\" \/><\/p>\n<h2>3.2\u5faa\u73af\u8bed\u53e5<\/h2>\n<h3>3.2.1for\u5faa\u73af<\/h3>\n<p>Python\u4e2d\u7684for\u5faa\u73af\u7528\u4e8e\u904d\u5386\u5e8f\u5217&#xff08;\u5982\u5217\u8868\u3001\u5143\u7ec4\u3001\u5b57\u7b26\u4e32&#xff09;\u6216\u5176\u4ed6\u53ef\u8fed\u4ee3\u5bf9\u8c61\u3002<\/p>\n<p>\u57fa\u672c\u8bed\u6cd5\u5982\u4e0b&#xff1a;<\/p>\n<p>for \u53d8\u91cf\u00a0\u00a0in \u5faa\u73af\u5185\u5bb9:<br \/>\n\u00a0 \u00a0 # \u6267\u884c\u4ee3\u7801\u5757<\/p>\n<p>\u4f7f\u7528for\u5faa\u73af\u53ef\u4ee5\u65b9\u4fbf\u5730\u904d\u5386\u5217\u8868\u4e2d\u7684\u6bcf\u4e2a\u5143\u7d20,\u5b57\u7b26\u4e32\u4e5f\u662f\u53ef\u8fed\u4ee3\u5bf9\u8c61&#xff0c;\u53ef\u4ee5\u9010\u4e2a\u5b57\u7b26\u904d\u5386<\/p>\n<p>range&#xff08;&#xff09; \u51fd\u6570\u529f\u80fd&#xff1a;range()\u51fd\u6570\u5e38\u4e0efor\u5faa\u73af\u914d\u5408\u4f7f\u7528&#xff0c;\u751f\u6210\u4e00\u4e2a\u6570\u5b57\u5e8f\u5217<\/p>\n<p>range&#xff08;\u53c2\u65701&#xff0c;\u53c2\u65702&#xff0c;\u53c2\u65703&#xff09;<\/p>\n<p>for i in range(4,8,2):<br \/>\n\u00a0 \u00a0 print(i) \u00a0# \u8f93\u51fa4,8<\/p>\n<p>\u6b65\u957f\u4e3a&#xff1a;2<\/p>\n<p>for\u5faa\u73af\u7684\u590d\u5408\u5199\u6cd5<\/p>\n<p>[\u8868\u8fbe\u5f0f for \u53d8\u91cf in \u5faa\u73af\u5185\u5bb9]<\/p>\n<p>\u5728\u5927\u591a\u6570\u7f16\u7a0b\u8bed\u8a00\u4e2d&#xff0c;for\u5faa\u73af\u7684\u6807\u51c6\u8bed\u6cd5\u901a\u5e38\u5305\u542b\u521d\u59cb\u5316\u3001\u6761\u4ef6\u5224\u65ad\u548c\u8fed\u4ee3\u4e09\u4e2a\u90e8\u5206&#xff1a;<\/p>\n<p>for i in range(0, 10, 2):<br \/>\n\u00a0 \u00a0 print(i)<\/p>\n<p>for\u5faa\u73af\u7684\u5d4c\u5957<br \/>\nimport time<br \/>\nfor i in range(60):<br \/>\n\u00a0\u00a0\u00a0\u00a0for j in range(60):<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0time.sleep(1)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0print(&#039;\u5f53\u524d\u65f6\u95f4\u4e3a{}\u5206:{}\u79d2&#039;.format(i,j))<br \/>\n\u00a0\u00a0\u00a0\u00a0print(&#039;1\u5206\u949f\u7ed3\u675f&#039;)<br \/>\nprint(&#039;\u7a0b\u5e8f\u7ed3\u675f&#039;)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"821\" src=\"2026-01-14v1varfvg3um.png\" width=\"957\" \/><\/p>\n<p>\u00a0<\/p>\n<h3>3.2.2while\u5faa\u73af<\/h3>\n<p>while \u6761\u4ef6\u5224\u65ad\u8868\u8fbe\u5f0f&#xff1a;<\/p>\n<p>\u4ee3\u7801\u5757<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"370\" src=\"2026-01-14po4s4jxuken.png\" width=\"397\" \/><\/p>\n<\/p>\n<h3>3.2.3\u5d4c\u5957\u5faa\u73af<\/h3>\n<p>break\u6253\u65ad\u5faa\u73af<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"535\" src=\"2026-01-1444wp53j3nwa.png\" width=\"747\" \/><\/p>\n<p>continue\u8df3\u8fc7\u5faa\u73af<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"467\" src=\"2026-01-143s05kdkwgiy.png\" width=\"742\" \/><\/p>\n<p>while True:<br \/>\n\u00a0 try:<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 n &#061; int(input(&#039;\u8bf7\u8f93\u51651\u4e2a\u6574\u6570:&#039;))<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 d &#061; 3\/n<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 print(n,d)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 break<br \/>\n\u00a0 except:<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 print(&#039;\u4f60\u8f93\u5165\u7684\u6570\u5b57\u4e0d\u6b63\u786e&#039;)<br \/>\nprint(&#039;\u7ee7\u7eed\u6267\u884c\u540e\u9762\u7684\u4ee3\u7801&#039;)<\/p>\n<h2>\n3.3\u5f02\u5e38\u5904\u7406\u8bed\u53e5<\/h2>\n<h3>3.3.1\u5f02\u5e38\u5904\u7406\u8bed\u53e5\u4f7f\u7528<\/h3>\n<\/p>\n<p>try:\u00a0 \u00a0<\/p>\n<p>\u00a0 \u00a0 \u4ee3\u7801\u57571<\/p>\n<p>except&#xff1a;<\/p>\n<p>\u00a0 \u00a0 \u4ee3\u7801\u57572<\/p>\n<h3>\n<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"612\" src=\"2026-01-145l3ksygu45z.png\" width=\"872\" \/><\/h3>\n<h3>3.3.2\u5f02\u5e38\u6355\u83b7<\/h3>\n<h3><\/h3>\n<p>\u8f93\u51651w\u540e\u51fa\u73b0ValueError\u9519\u8bef&#xff0c;\u56e0\u4e3aInt&#xff08;&#xff09;\u65e0\u6cd5\u5c061w\u8f6c\u5316\u4e3a\u6574\u6570<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"337\" src=\"2026-01-14nkdxvhm1chw.png\" width=\"887\" \/><\/p>\n<p>\u8f93\u51650\u540e\u51fa\u73b0ZerodivisionError(\u96f6\u9664\u9519\u8bef&#xff09;<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"332\" src=\"2026-01-14hb2giyzbcgu.png\" width=\"860\" \/><\/p>\n<p>\u7528try&#043;except\u6355\u83b7\u6307\u5b9a\u7684\u5f02\u5e38\u9519\u8bef\u7c7b\u578b<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"574\" src=\"2026-01-145nsfgblpars.png\" width=\"452\" \/><\/p>\n<\/p>\n<h3>\u9879\u76ee\u5b9e\u4f8b&#xff1a;\u5b9e\u73b0\u6a21\u62df\u8d85\u5e02\u6536\u94f6\u7cfb\u7edf<\/h3>\n<\/p>\n<p>\u9879\u76ee\u4efb\u52a1&#xff1a;<\/p>\n<p>\u8bbe\u8ba1\u4e00\u4e2a\u4ee3\u7801\u7a0b\u5e8f&#xff0c;\u7528\u4e8e\u5b9e\u73b0\u5728\u8425\u4e1a\u5458\u8f93\u5165\u767d\u83dc\u91cd\u91cf\u4e4b\u540e\u81ea\u52a8\u8ba1\u7b97\u51fa\u987e\u5ba2\u9700\u8981\u652f\u4ed8\u7684\u91d1\u989d<\/p>\n<p>\u9879\u76ee\u5b9e\u73b0\u4ee3\u7801&#xff1a;<\/p>\n<p>while True:<br \/>\n    try:<br \/>\n        weight &#061; float(input(&#034;\u8bf7\u8f93\u5165\u767d\u83dc\u7684\u91cd\u91cf:&#034;))<br \/>\n        break<br \/>\n    except:<br \/>\n        print(&#034;\u8f93\u5165\u9519\u8bef&#xff0c;\u91cd\u65b0\u8f93\u5165,&#034;,end&#061;&#039;&#039;)<br \/>\nif weight &lt; 2.0:<br \/>\n    print(&#034;\u8bf7\u4ed8\u6b3e:&#034;,weight*2.5*0.9,&#039;\u5143&#039;)<br \/>\nelif weight &lt; 4.0:<br \/>\n    print(&#034;\u8bf7\u4ed8\u6b3e:&#034;,weight*2.5*0.8,&#039;\u5143&#039;)<br \/>\nelif weight &lt;10.0:<br \/>\n    print(&#034;\u8bf7\u4ed8\u6b3e:&#034;,weight*2.5*0.6,&#039;\u5143&#039;)<br \/>\nelse:<br \/>\n    print(&#034;\u8bf7\u4ed8\u6b3e:&#034;,weight*2.5*0.4,&#039;\u5143&#039;)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"537\" src=\"2026-01-14hluxtox3dbh.png\" width=\"1080\" \/><\/p>\n<h2>4.\u7ec4\u5408\u6570\u636e\u7c7b\u578b<\/h2>\n<h3>4.1.1\u5217\u8868\u7c7b\u578b\u4ecb\u7ecd<\/h3>\n<p>\u5217\u8868\u76f8\u5f53\u4e8e\u4e00\u4e2a\u5bb9\u5668[\u5143\u7d201&#xff0c;\u5143\u7d202&#xff0c;\u5143\u7d203&#xff0c;&#8230;]<\/p>\n<h3>4.1.2\u83b7\u53d6\u5217\u8868\u5143\u7d20<\/h3>\n<p>\u7d22\u5f15\u83b7\u53d6\u5217\u8868\u5143\u7d20:list[i]<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"517\" src=\"2026-01-14ul2zv02fqjb.png\" width=\"557\" \/><\/p>\n<p>\u5207\u7247\u83b7\u53d6\u5217\u8868\u5143\u7d20:list[\u5f00\u59cb\u4f4d\u7f6e : \u7ed3\u675f\u4f4d\u7f6e : \u6b65\u957f]<\/p>\n<p>\u987e\u5934\u4e0d\u987e\u5c3e&#xff08;\u5de6\u95ed\u53f3\u5f00&#xff09;&#xff1a;<br \/>\n\u5305\u542b\u201c\u5f00\u59cb\u4f4d\u7f6e\u201d\u7684\u5143\u7d20\u3002<br \/>\n\u4e0d\u5305\u542b\u201c\u7ed3\u675f\u4f4d\u7f6e\u201d\u7684\u5143\u7d20\u3002<br \/>\n\u4f8b\u5982&#xff1a;[1:4] \u62ff\u7684\u662f\u7d22\u5f15 1\u30012\u30013 \u7684\u5143\u7d20&#xff0c;\u4e0d\u62ff\u7d22\u5f15 4\u3002<br \/>\n\u53c2\u6570\u53ef\u4ee5\u7701\u7565&#xff1a;<br \/>\n\u5982\u679c\u7701\u7565\u201c\u5f00\u59cb\u4f4d\u7f6e\u201d&#xff0c;\u9ed8\u8ba4\u4ece 0 \u5f00\u59cb&#xff08;\u6216\u6839\u636e\u6b65\u957f\u51b3\u5b9a&#xff09;\u3002<br \/>\n\u5982\u679c\u7701\u7565\u201c\u7ed3\u675f\u4f4d\u7f6e\u201d&#xff0c;\u9ed8\u8ba4\u5207\u5230\u5217\u8868\u672b\u5c3e&#xff08;\u6216\u6839\u636e\u6b65\u957f\u51b3\u5b9a&#xff09;\u3002<br \/>\n\u5982\u679c\u7701\u7565\u201c\u6b65\u957f\u201d&#xff0c;\u9ed8\u8ba4\u4e3a 1&#xff08;\u9010\u4e2a\u53d6&#xff09;\u3002<br \/>\n\u6b65\u957f&#xff08;Step&#xff09;\u7684\u5999\u7528&#xff1a;<br \/>\n\u6b65\u957f\u4e3a\u6b63\u6570&#xff1a;\u4ece\u5de6\u5f80\u53f3\u53d6\u3002<br \/>\n\u6b65\u957f\u4e3a\u8d1f\u6570&#xff1a;\u4ece\u53f3\u5f80\u5de6\u53d6&#xff08;\u5e38\u7528\u4e8e\u53cd\u8f6c\u5217\u8868&#xff09;\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"693\" src=\"2026-01-14ivwak1gxxir.png\" width=\"687\" \/><\/p>\n<h3>4.1.3\u5d4c\u5957\u5217\u8868\u7684\u7d22\u5f15\u65b9\u6cd5<\/h3>\n<p>\u56e0\u6b64\u5f53\u5217\u8868\u4e2d\u5305\u542b\u591a\u5c42\u5b50\u5217\u8868\u65f6&#xff0c;\u53d6\u6700\u5185\u5c42\u5b50\u5217\u8868\u4e2d\u7684\u5143\u7d20\u7684\u65b9\u6cd5\u4e3als[\u7d22\u5f15\u53f7][\u7d22\u5f15\u53f7][\u7d22\u5f15\u53f7]\u5f53\u5217\u8868ls\u4e2d\u5305\u542b\u5b50\u5217\u8868&#xff0c;\u4e14\u5b50\u5217\u8868\u4e2d\u53c8\u5305\u542b\u5b50\u5217\u8868\u65f6&#xff0c;\u83b7\u53d6\u5b50\u5217\u8868\u4e2d\u7684\u5b50\u5217\u8868\u7684\u5143\u7d20\u7684\u65b9\u6cd5\u4e3als[\u7d22\u5f15\u53f7][\u7d22\u5f15\u53f7][\u7d22\u5f15\u53f7]&#8230;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"262\" src=\"2026-01-14m5zeox4jek0.png\" width=\"433\" \/><\/p>\n<h3>4.1.4\u5faa\u73af\u8bbf\u95ee\u5217\u8868\u7684\u5143\u7d20<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"326\" src=\"2026-01-143n030lj1blj.png\" width=\"439\" \/><\/p>\n<h3>4.1.5\u5217\u8868\u7c7b\u578b\u7684\u51fd\u6570<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"383\" src=\"2026-01-14f40gmo23vyu.png\" width=\"578\" \/><\/p>\n<p>\u56e0\u4e3a list() \u51fd\u6570\u4e0d\u80fd\u76f4\u63a5\u5c06\u6574\u6570\u8f6c\u6362\u4e3a\u5217\u8868\u3002b&#061;12 \u662f\u4e00\u4e2a\u6574\u6570&#xff0c;list(b) \u4f1a\u629b\u51fa TypeError&#xff0c;\u56e0\u4e3a\u6574\u6570\u4e0d\u80fd\u76f4\u63a5\u8f6c\u6362\u4e3a\u5217\u8868\u3002<\/p>\n<h3>4.1.6\u5217\u8868\u7c7b\u578b\u7684\u65b9\u6cd5<\/h3>\n<p>append(\u53c2\u6570&#xff09;\u65b9\u6cd5<\/p>\n<p>\u529f\u80fd&#xff1a;\u5728\u5217\u8868\u7684\u6700\u540e\u589e\u52a0\u4e00\u4e2a\u5143\u7d20<\/p>\n<p>clear()\u65b9\u6cd5<\/p>\n<p>\u529f\u80fd&#xff1a;\u6e05\u9664\u5217\u8868\u4e2d\u7684\u6240\u6709\u5143\u7d20&#xff0c;\u62ec\u53f7\u4e2d\u65e0\u9700\u586b\u5165\u53c2\u6570<\/p>\n<p>copy&#xff08;&#xff09;\u65b9\u6cd5<\/p>\n<p>\u529f\u80fd&#xff1a;\u590d\u5236\u4e00\u4e2a\u65b0\u7684\u5217\u8868<\/p>\n<p>count&#xff08;\u53c2\u6570&#xff09;\u65b9\u6cd5<\/p>\n<p>\u529f\u80fd&#xff1a;\u7edf\u8ba1\u53c2\u6570\u5728\u5217\u8868\u4e2d\u7684\u4e2a\u6570<\/p>\n<p>index&#xff08;\u53c2\u6570&#xff09;\u65b9\u6cd5<\/p>\n<p>\u529f\u80fd&#xff1a;\u83b7\u53d6\u53c2\u6570\u5728\u5217\u8868\u4e2d\u7684\u7d22\u5f15\u53f7<\/p>\n<p>insert&#xff08;\u53c2\u65701&#xff0c;\u53c2\u65702&#xff09;\u65b9\u6cd5<\/p>\n<p>\u529f\u80fd&#xff1a;\u5728\u5217\u8868\u7d22\u5f15\u53f7\u4e3a\u53c2\u65701\u7684\u4f4d\u7f6e\u5904\u63d2\u5165\u4e00\u4e2a\u5143\u7d20&#xff0c;\u5176\u63d2\u5165\u7684\u5143\u7d20\u5185\u5bb9\u4e3a\u53c2\u65702<\/p>\n<p>pop(\u53c2\u6570&#xff09;\u65b9\u6cd5<\/p>\n<p>\u529f\u80fd&#xff1a;\u5220\u9664\u5217\u8868\u4e2d\u7d22\u5f15\u53f7\u4e3a\u53c2\u6570\u7684\u5143\u7d20<\/p>\n<p>remove&#xff08;\u53c2\u6570&#xff09;\u65b9\u6cd5<\/p>\n<p>\u529f\u80fd&#xff1a;\u5220\u9664\u5217\u8868\u4e2d\u7b2c\u4e00\u6b21\u51fa\u73b0\u7684\u53c2\u6570\u5143\u7d20<\/p>\n<p>reverse&#xff08;&#xff09;\u65b9\u6cd5<br \/>\n\u529f\u80fd&#xff1a;\u7ffb\u8f6c\u5217\u8868<br \/>\nsort&#xff08;\u53c2\u6570&#xff09;\u65b9\u6cd5<br \/>\n\u529f\u80fd&#xff1a;\u5bf9\u5217\u8868\u8fdb\u884c\u6392\u5e8f<\/p>\n<h2>4.2\u5143\u7ec4\u7c7b\u578b<\/h2>\n<p>\u5143\u7ec4\u7c7b\u578b&#xff08;\u5143\u7d201&#xff0c;\u5143\u7d202&#xff0c;\u5143\u7d203&#xff0c;&#8230;&#xff09;<\/p>\n<p>\u5143\u7ec4\u6570\u636e\u4e00\u65e6\u88ab\u521b\u5efa&#xff0c;\u5c31\u4e0d\u80fd\u4fee\u6539&#xff0c;\u4e3a\u4e86\u5b89\u5168<\/p>\n<h2>4.3\u5b57\u5178\u7c7b\u578b<\/h2>\n<h3>4.3.1\u5b57\u5178\u7c7b\u578b\u7684\u4ecb\u7ecd<\/h3>\n<p>\u5b57\u5178&#xff1a;\u5b58\u50a8\u7528\u6237\u4fe1\u606f<\/p>\n<p>\u5217\u8868&#xff1a;[\u5f20\u4e09,\u674e\u56db,\u738b\u4e94\u3002\u3002\u3002]<\/p>\n<p>{\u952e1&#xff1a;\u503c1&#xff0c;\u952e2&#xff1a;\u503c2&#xff0c;\u952e3&#xff1a;\u503c3&#xff0c;&#8230;}\u4e09\u4e2a\u952e\u503c\u5bf9&#xff0c;\u4e09\u4e2a\u6570\u636e\u5143\u7d20<\/p>\n<p>\u5b57\u5178\u7c7b\u578b\u6700\u5927\u7684\u7279\u70b9&#xff1a;\u6ca1\u6709\u5e8f\u53f7<\/p>\n<h3>4.3.2\u83b7\u53d6\u5b57\u5178\u5143\u7d20<\/h3>\n<p>\u4e0d\u80fd\u7528\u7d22\u5f15\u6216\u8005\u5207\u7247&#xff0c;\u8981\u7528\u952e\u6765\u83b7\u53d6<\/p>\n<h3>4.3.3\u5b57\u5178\u7c7b\u578b\u7684\u65b9\u6cd5<\/h3>\n<p>print(dir(dict))<\/p>\n<p>clear()\u65b9\u6cd5<\/p>\n<p>\u529f\u80fd&#xff1a;\u6e05\u9664\u5b57\u5178\u4e2d\u7684\u6570\u636e\u5143\u7d20&#xff0c;\u5220\u9664\u6574\u4e2a\u5b57\u5178\u7528\u4fdd\u7559\u5b57del<\/p>\n<p>get(\u53c2\u65701&#xff0c;\u53c2\u65702&#xff09;\u65b9\u6cd5<\/p>\n<p>\u529f\u80fd&#xff1a;\u67e5\u627e\u53c2\u65701\u662f\u5426\u4e3a\u5b57\u5178\u4e2d\u7684\u952e\u3002\u5982\u679c\u662f\u5b57\u5178\u4e2d\u7684\u952e&#xff0c;\u8fd4\u56de\u952e\u5bf9\u5e94\u7684\u503c&#xff0c;\u5982\u679c\u4e0d\u662f\u5b57\u5178\u4e2d\u7684\u952e&#xff0c;\u8fd4\u56de\u53c2\u65702\u7684\u503c&#xff0c;\u82e5\u53c2\u65702\u6ca1\u6709\u5185\u5bb9&#xff1a;\u8fd4\u56deNone<\/p>\n<p>Keys()\u65b9\u6cd5<\/p>\n<p>\u529f\u80fd&#xff1a;\u83b7\u53d6\u5b57\u5178\u4e2d\u7684\u5168\u90e8\u952e\u4fe1\u606f<\/p>\n<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>python:pycharm&#xff08;\u7f16\u7a0b&#xff09;,jupyter&#xff08;\u5b66\u6821\u5e38\u7528&#xff09;,idle&#xff08;\u4e0d\u65b9\u4fbf\u5f00\u53d1&#xff09;,vsc&#xff08;c&#xff09;\u8bbe\u7f6e&#xff1a;\u63d2\u4ef6&#xff0c;\u6539\u4e2d\u6587\u8bbe\u7f6e&#xff1a;\u9879\u76ee&#xff1a;python\u89e3\u91ca\u5668&#xff1a;\u4fee\u6539\u89e3\u91ca\u56682.1.2\u8282\u51fd\u6570&#xff1a;print&#xff08;&#xff09;\u51fd\u65701.\u53c2\u6570\u4e3a\u5b57\u7b26\u4e32&#xff08;\u7528\u5355\u5f15\u53f7\u6216\u8005\u53cc\u5f15\u53f7\u5f15\u8d77\u6765\u7684<\/p>\n","protected":false},"author":2,"featured_media":59507,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[81],"topic":[],"class_list":["post-59527","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>python\u57fa\u7840 - \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\/59527.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"python\u57fa\u7840 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"python:pycharm&#xff08;\u7f16\u7a0b&#xff09;,jupyter&#xff08;\u5b66\u6821\u5e38\u7528&#xff09;,idle&#xff08;\u4e0d\u65b9\u4fbf\u5f00\u53d1&#xff09;,vsc&#xff08;c&#xff09;\u8bbe\u7f6e&#xff1a;\u63d2\u4ef6&#xff0c;\u6539\u4e2d\u6587\u8bbe\u7f6e&#xff1a;\u9879\u76ee&#xff1a;python\u89e3\u91ca\u5668&#xff1a;\u4fee\u6539\u89e3\u91ca\u56682.1.2\u8282\u51fd\u6570&#xff1a;print&#xff08;&#xff09;\u51fd\u65701.\u53c2\u6570\u4e3a\u5b57\u7b26\u4e32&#xff08;\u7528\u5355\u5f15\u53f7\u6216\u8005\u53cc\u5f15\u53f7\u5f15\u8d77\u6765\u7684\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/59527.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-13T16:09:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160911-69666e2792848.png\" \/>\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=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/59527.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/59527.html\",\"name\":\"python\u57fa\u7840 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-13T16:09:18+00:00\",\"dateModified\":\"2026-01-13T16:09:18+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/59527.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/59527.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/59527.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"python\u57fa\u7840\"}]},{\"@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\u7840 - \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\/59527.html","og_locale":"zh_CN","og_type":"article","og_title":"python\u57fa\u7840 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"python:pycharm&#xff08;\u7f16\u7a0b&#xff09;,jupyter&#xff08;\u5b66\u6821\u5e38\u7528&#xff09;,idle&#xff08;\u4e0d\u65b9\u4fbf\u5f00\u53d1&#xff09;,vsc&#xff08;c&#xff09;\u8bbe\u7f6e&#xff1a;\u63d2\u4ef6&#xff0c;\u6539\u4e2d\u6587\u8bbe\u7f6e&#xff1a;\u9879\u76ee&#xff1a;python\u89e3\u91ca\u5668&#xff1a;\u4fee\u6539\u89e3\u91ca\u56682.1.2\u8282\u51fd\u6570&#xff1a;print&#xff08;&#xff09;\u51fd\u65701.\u53c2\u6570\u4e3a\u5b57\u7b26\u4e32&#xff08;\u7528\u5355\u5f15\u53f7\u6216\u8005\u53cc\u5f15\u53f7\u5f15\u8d77\u6765\u7684","og_url":"https:\/\/www.wsisp.com\/helps\/59527.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-13T16:09:18+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113160911-69666e2792848.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/59527.html","url":"https:\/\/www.wsisp.com\/helps\/59527.html","name":"python\u57fa\u7840 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-13T16:09:18+00:00","dateModified":"2026-01-13T16:09:18+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/59527.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/59527.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/59527.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"python\u57fa\u7840"}]},{"@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\/59527","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=59527"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/59527\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/59507"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=59527"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=59527"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=59527"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=59527"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}