{"id":180773,"date":"2022-04-17T21:17:47","date_gmt":"2022-04-17T13:17:47","guid":{"rendered":"http:\/\/www.idc.net\/help\/180773\/"},"modified":"2022-04-17T21:17:47","modified_gmt":"2022-04-17T13:17:47","slug":"%e5%90%8e%e6%b5%aa%e4%ba%91python%e6%95%99%e7%a8%8b%ef%bc%9apython%e5%92%8cc%e8%af%ad%e8%a8%80%e5%93%aa%e4%b8%aa%e9%9a%be","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/180773\/","title":{"rendered":"\u540e\u6d6a\u4e91Python\u6559\u7a0b\uff1apython\u548cc\u8bed\u8a00\u54ea\u4e2a\u96be"},"content":{"rendered":"<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/oss.py.cn\/pycn\/upload\/article\/000\/000\/004\/5de9c1aa1c3da830.jpg\" class=\"aligncenter\"><\/p>\n<p>C\u8bed\u8a00\u662f\u7f16\u8bd1\u578b\u8bed\u8a00\uff0c\u7ecf\u8fc7\u7f16\u8bd1\u540e\uff0c\u751f\u6210\u673a\u5668\u7801\uff0c\u7136\u540e\u518d\u8fd0\u884c\uff0c\u6267\u884c\u901f\u5ea6\u5feb\uff0c\u4e0d\u80fd\u8de8\u5e73\u53f0\uff0c\u4e00\u822c\u7528\u4e8e\u64cd\u4f5c\u7cfb\u7edf\uff0c\u9a71\u52a8\u7b49\u5e95\u5c42\u5f00\u53d1\u3002<\/p>\n<p>Python\u662f\u7f16\u8bd1\u578b\u8fd8\u662f\u89e3\u91ca\u578b\u8fd9\u4e2a\u754c\u9650\u5e76\u4e0d\u660e\u663e\uff0c\u4f46\u5927\u81f4\u4e0a\u53ef\u4ee5\u7406\u89e3\u4e3a\u89e3\u91ca\u578b\u8bed\u8a00\uff0c\u6267\u884c\u901f\u5ea6\u6162\uff0c\u7531\u4e8ePython\u865a\u62df\u673a\uff0cPython\u662f\u53ef\u4ee5\u8de8\u5e73\u53f0\u7684\uff0cPython\u9ad8\u5ea6\u96c6\u6210\u9002\u5408\u4e8e\u8f6f\u4ef6\u7684\u5feb\u901f\u5f00\u53d1\u3002<\/p>\n<p>C\u8bed\u8a00\u4e2d\u9700\u8981\u4e8b\u5148\u5b9a\u4e49\u53d8\u91cf\u7c7b\u578b\uff0c\u4ee5int\u7c7b\u578b\u4e3a\u4f8b\uff0c\u5f53\u5b9a\u4e49\u4e00\u4e2aint\u578b\u53d8\u91cf\u540e\uff0c\u5c31\u4f1a\u5728\u5185\u5b58\u4e2d\u5f00\u8f9f4\u4e2a\u5b57\u8282\uff0c\u518d\u6765\u8fdb\u884c\u521d\u59cb\u5316\uff0c\u7531\u4e8e\u957f\u5ea6\u662f\u6307\u5b9a\u7684\uff0c\u5728\u8fd0\u7b97\u8fc7\u7a0b\u4e2d\u9700\u8981\u8003\u8651\uff0c\u6ea2\u51fa\uff0c\u7cbe\u5ea6\u7b49\u95ee\u9898\u3002<\/p>\n<p>\u63a8\u8350\u5b66\u4e60\u300apython\u6559\u7a0b\u300b<\/p>\n<p>Python\u4e0d\u9700\u8981\u4e8b\u5148\u5b9a\u4e49\u53d8\u91cf\u7c7b\u578b\uff0c\u4ee5a=3\u4e3a\u4f8b\uff0c\u5728\u5185\u5b58\u4e2d\u5b58\u653e\u4e00\u4e2a\u6574\u65703\uff0c\u7136\u540e\u518d\u7528\u53d8\u91cfa\u6307\u54113\uff0c\u53d8\u91cfa\u662f\u6ca1\u6709\u7c7b\u578b\u7684\uff0c\u6211\u4eec\u6240\u8bf4\u7684\u7c7b\u578b\u662f\u6307\u53d8\u91cf\u6240\u6307\u7684\u5185\u5b58\u4e2d\u5bf9\u8c61\u7684\u7c7b\u578b\u3002<\/p>\n<p>\u4ece\u6570\u636e\u7c7b\u578b\u4e0a\u5c31\u53ef\u4ee5\u770b\u51faPython\u7684\u53cb\u597d\u6027\uff0c\u57fa\u672c\u6570\u636e\u7c7b\u578b\u53d8\u5c11\u4e86\uff0c\u6ca1\u6709\u70e6\u4eba\u7684\u6307\u9488\uff0c\u4e0d\u9700\u8981\u8003\u8651\u6570\u636e\u6ea2\u51fa\u548c\u7cbe\u5ea6\u7684\u95ee\u9898\uff0c\u5f53\u5728\u7a0b\u5e8f\u4e2d\u9700\u8981\u4f7f\u7528\u67d0\u4e2a\u53d8\u91cf\u65f6\uff0c\u5c31\u80fd\u591f\u76f4\u63a5\u4f7f\u7528\uff0c\u800c\u4e0d\u9700\u8981\u5728\u7a0b\u5e8f\u5f00\u5934\u5b9a\u4e49\u53d8\u91cf\u3002\u9664\u6b64\u4e4b\u5916\uff0cPython\u8fd8\u63d0\u4f9b\u4e86str,list,dict\u8fd9\u4e9b\u5f3a\u5927\u7684\u6570\u636e\u7c7b\u578b\uff0c\u8ba9\u7a0b\u5e8f\u5f00\u53d1\u53d8\u7684\u66f4\u4e3a\u7b80\u5355\u3002<\/p>\n<p>Python\u8fd8\u63d0\u4f9b\u4e86\u4e00\u4e2a\u4ea4\u4e92\u754c\u9762\uff0c\u8f93\u5165python\u8fdb\u5165\u4ea4\u4e92\u754c\u9762\uff0c\u8f93\u5165exit()\u9000\u51fa\u4ea4\u4e92\u754c\u9762\uff0c\u7c7b\u4f3c\u4e8eLinux\u7ec8\u7aef\uff0c\u8f93\u5165\u4e00\u884c\u547d\u4ee4\uff0c\u6267\u884c\u4e00\u884c\uff0c\u4e3a\u5b66\u4e60Python\u63d0\u4f9b\u4e86\u5f88\u5927\u7684\u4fbf\u5229\u3002<\/p>\n<p>\u5728\u8fd0\u7b97\u7b26\u548c\u4f18\u5148\u7ea7\u4e0a\u9762\uff0c\u4e24\u8005\u5e76\u6ca1\u6709\u5927\u7684\u533a\u522b\uff0c\u4f46\u5728python\u4e2d\u6ca1\u6709\u81ea\u52a0\u548c\u81ea\u51cf\u8fd0\u7b97\u7b26\uff0c\u5728\u903b\u8f91\u8fd0\u7b97\u7b26\u4e0aPython\u4e5f\u533a\u522b\u4e8eC\u8bed\u8a00\uff0cPython\u4e2d\u662fand\uff0cor\uff0cnot \uff0c\u800cC\u8bed\u8a00\u4e2d\u5219\u662f&amp;&amp;\uff0c||\uff0c\uff01<\/p>\n<p>Python\u4e2d\u901a\u8fc7\u7f29\u8fdb\u6765\u8868\u793a\u8bed\u53e5\u4f53\uff0cC\u8bed\u8a00\u901a\u8fc7{}\u6765\u8868\u793a\u8bed\u53e5\u4f53\uff0c\u5e76\u4e14\u5728Python\u4e2d\u6bcf\u4e00\u6761\u8bed\u53e5\u7ed3\u5c3e\u540e\u6ca1\u6709\u5206\u53f7\uff0c\u5224\u65ad\u8bed\u53e5if else\uff0c\u8fd9\u4e24\u8005\u6ca1\u6709\u533a\u522b\uff0c\u5faa\u73af\u8bed\u53e5while\u4e5f\u6ca1\u6709\uff0c\u53ea\u662ffor\u5faa\u73af\uff0cPython\u901a\u8fc7for&nbsp; in\u6765\u8868\u793a\u3002<\/p>\n<p>Python\u6709\u5f88\u591a\u5185\u7f6e\u51fd\u6570\uff08build in function\uff09,\u4e0d\u9700\u8981\u5199\u5934\u6587\u4ef6\uff0cPython\u8fd8\u6709\u5f88\u591a\u5f3a\u5927\u7684\u6a21\u5757\uff0c\u9700\u8981\u65f6\u5bfc\u5165\u4fbf\u53ef\u3002C\u8bed\u8a00\u5728\u8fd9\u4e00\u70b9\u4e0a\u8fdc\u4e0d\u53caPython,\u5927\u591a\u65f6\u5019\u90fd\u9700\u8981\u81ea\u5df1\u624b\u52a8\u5b9e\u73b0\u3002<\/p>\n<p>C\u8bed\u8a00\u4e2d\u7684\u51fd\u6570\uff0c\u6709\u7740\u4e25\u683c\u7684\u987a\u5e8f\u9650\u5236\uff0c\u5982\u679c\u8981\u8c03\u7528\u51fd\u6570\uff0c\u8be5\u51fd\u6570\u9700\u8981\u5728\u672c\u6b21\u8c03\u7528\u4e4b\u524d\u5c31\u9700\u8981\u88ab\u5b9e\u73b0\uff0c\u6216\u8005\u5728\u7a0b\u5e8f\u5f00\u5934\u4e8b\u5148\u58f0\u660e\uff0c\u800cPython\u4e2d\u5219\u6ca1\u6709\u8fd9\u4e2a\u9650\u5236\uff0cPython\u4e2d\u8fd8\u6709\u9ad8\u9636\u51fd\u6570\u8fd9\u4e00\u6982\u5ff5\uff0c\u5373\u51fd\u6570\u540d\u4e5f\u53ef\u5f53\u4f5c\u51fd\u6570\u53c2\u6570\uff0c\u51fd\u6570\u540d\u4e5f\u662f\u4e00\u79cd\u53d8\u91cf\uff0c\u6307\u5411\u5185\u5b58\u4e2d\u7684\u67d0\u4e2a\u51fd\u6570\uff0c\u8fd9\u79cd\u5199\u6cd5\u53ef\u4ee5\u5927\u5927\u51cf\u5c11\u4ee3\u7801\u957f\u5ea6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>C\u8bed\u8a00\u662f\u7f16\u8bd1\u578b\u8bed\u8a00\uff0c\u7ecf\u8fc7\u7f16\u8bd1\u540e\uff0c\u751f\u6210\u673a\u5668\u7801\uff0c\u7136\u540e\u518d\u8fd0\u884c\uff0c\u6267\u884c\u901f\u5ea6\u5feb\uff0c\u4e0d\u80fd\u8de8\u5e73\u53f0\uff0c\u4e00\u822c\u7528\u4e8e\u64cd\u4f5c\u7cfb\u7edf\uff0c\u9a71\u52a8\u7b49\u5e95\u5c42\u5f00 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":180774,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[182397],"tags":[],"class_list":["post-180773","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/180773","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=180773"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/180773\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media\/180774"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=180773"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=180773"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=180773"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}