{"id":128,"date":"2025-10-18T15:42:25","date_gmt":"2025-10-18T07:42:25","guid":{"rendered":"http:\/\/47.99.178.170\/?p=128"},"modified":"2025-10-23T21:51:44","modified_gmt":"2025-10-23T13:51:44","slug":"python%e5%9f%ba%e7%a1%80%e8%af%ad%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.garfield-blog.top\/?p=128","title":{"rendered":"\u3010\u7f16\u7a0b\u8bed\u8a00\u5b66\u4e60\u3011Python\u57fa\u7840\u8bed\u6cd5"},"content":{"rendered":"\n<p><code>Python<\/code> \u662f\u4e00\u4e2a\u9ad8\u5c42\u6b21\u7684\u7ed3\u5408\u4e86\u89e3\u91ca\u6027\u3001\u7f16\u8bd1\u6027\u3001\u4e92\u52a8\u6027\u548c\u9762\u5411\u5bf9\u8c61\u7684\u811a\u672c\u8bed\u8a00\u3002\u4e0d\u540c\u4e8e<code>C\/C++<\/code>\u8bed\u8a00\u9700\u8981\u7f16\u8bd1\u6210\u53ef\u6267\u884c\u6587\u4ef6\uff0c<code>python<\/code>\u6267\u884c\u65f6\u9700\u8981\u4e00\u4e2a\u89e3\u91ca\u5668\u6765\u6267\u884c<code>python<\/code>\u6e90\u7801<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\u53c2\u8003\u6587\u732e<\/p>\n\n\n\n<p>1.\u83dc\u9e1f\u6559\u7a0bpython\u8bed\u6cd5\u90e8\u5206<\/p>\n\n\n\n<p><a href=\"https:\/\/docs.python.org\/zh-cn\/3.13\/tutorial\/\">Python \u6559\u7a0b \u2014 Python 3.13.5 \u6587\u6863<\/a><\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">\u53d8\u91cf\u7c7b\u578b<\/h2>\n\n\n\n<p><strong>Python\u6709\u4e94\u4e2a\u6807\u51c6\u7684\u6570\u636e\u7c7b\u578b\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>Numbers<\/code>\uff08\u6570\u5b57\uff09<\/li>\n\n\n\n<li><code>String<\/code>\uff08\u5b57\u7b26\u4e32\uff09<\/li>\n\n\n\n<li><code>List<\/code>\uff08\u5217\u8868\uff09<\/li>\n\n\n\n<li><code>Tuple<\/code>\uff08\u5143\u7ec4\uff09<\/li>\n\n\n\n<li><code>Dictionary<\/code>\uff08\u5b57\u5178\uff09<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">1. Numbers\uff08\u6570\u5b57\uff09<\/h3>\n\n\n\n<p><strong>\u6570\u5b57\u6570\u636e\u7c7b\u578b\u7528\u4e8e\u5b58\u50a8\u6570\u503c\uff0cPython\u652f\u6301\u56db\u79cd\u4e0d\u540c\u7684\u6570\u5b57\u7c7b\u578b\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>int<\/code>\uff08\u6709\u7b26\u53f7\u6574\u578b\uff09<\/li>\n\n\n\n<li><code>long<\/code>\uff08\u957f\u6574\u578b\uff0c\u4e5f\u53ef\u4ee5\u4ee3\u8868\u516b\u8fdb\u5236\u548c\u5341\u516d\u8fdb\u5236\uff09<\/li>\n\n\n\n<li><code>float<\/code>\uff08\u6d6e\u70b9\u578b\uff09<\/li>\n\n\n\n<li><code>complex<\/code>\uff08\u590d\u6570\uff09<\/li>\n<\/ul>\n\n\n\n<p><strong>\u4ed6\u4eec\u662f\u4e0d\u53ef\u6539\u53d8\u7684\u6570\u636e\u7c7b\u578b\uff0c\u8fd9\u610f\u5473\u7740\u6539\u53d8\u6570\u5b57\u6570\u636e\u7c7b\u578b\u4f1a\u5206\u914d\u4e00\u4e2a\u65b0\u7684\u5bf9\u8c61<\/strong><\/p>\n\n\n\n<p>\u5f53\u4f60\u6307\u5b9a\u4e00\u4e2a\u503c\u65f6\uff0c<code>Number<\/code> \u5bf9\u8c61\u5c31\u4f1a\u88ab\u521b\u5efa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var1 = 1\nvar2 = 10<\/code><\/pre>\n\n\n\n<p>\u53ef\u4ee5\u4f7f\u7528<code>del<\/code>\u8bed\u53e5\u5220\u9664\u4e00\u4e9b\u5bf9\u8c61\u7684\u5f15\u7528<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>del var1&#91;,var2&#91;,var3&#91;....,varN]]]<\/code><\/pre>\n\n\n\n<p>\u4e5f\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528<code>del<\/code>\u8bed\u53e5\u5220\u9664\u5355\u4e2a\u6216\u591a\u4e2a\u5bf9\u8c61\u7684\u5f15\u7528\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>del var\ndel var_a, var_b<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. String\uff08\u5b57\u7b26\u4e32\uff09<\/h3>\n\n\n\n<p>\u5b57\u7b26\u4e32\u6216\u4e32<code>String<\/code>\u662f\u7531\u6570\u5b57\u3001\u5b57\u6bcd\u3001\u4e0b\u5212\u7ebf\u7ec4\u6210\u7684\u4e00\u4e32\u5b57\u7b26<\/p>\n\n\n\n<p><strong>\u4e00\u822c\u8bb0\u4e3a :<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>s = \"a1a2\u00b7\u00b7\u00b7an\"   # n&gt;=0<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u4f60\u8981\u5b9e\u73b0\u4ece\u5b57\u7b26\u4e32\u4e2d\u83b7\u53d6\u4e00\u6bb5\u5b50\u5b57\u7b26\u4e32\u7684\u8bdd\uff0c\u53ef\u4ee5\u4f7f\u7528 <code>[\u5934\u4e0b\u6807:\u5c3e\u4e0b\u6807]<\/code> \u6765\u622a\u53d6\u76f8\u5e94\u7684\u5b57\u7b26\u4e32\uff0c\u5176\u4e2d\u4e0b\u6807\u662f\u4ece <code>0<\/code> \u5f00\u59cb\u7b97\u8d77\uff0c\u53ef\u4ee5\u662f\u6b63\u6570\u6216\u8d1f\u6570\uff0c\u4e0b\u6807\u53ef\u4ee5\u4e3a\u7a7a\u8868\u793a\u53d6\u5230\u5934\u6216\u5c3e\u3002<code>[\u5934\u4e0b\u6807:\u5c3e\u4e0b\u6807]<\/code> \u83b7\u53d6\u7684\u5b50\u5b57\u7b26\u4e32\u5305\u542b\u5934\u4e0b\u6807\u7684\u5b57\u7b26\uff0c\u4f46\u4e0d\u5305\u542b\u5c3e\u4e0b\u6807\u7684\u5b57\u7b26\u3002<\/p>\n\n\n\n<p><strong>\u5982\u4e0b\u5b9e\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>str = 'Hello World!'\n\nprint(str)            # \u8f93\u51fa\u5b8c\u6574\u5b57\u7b26\u4e32\nprint(str&#91;0])         # \u8f93\u51fa\u5b57\u7b26\u4e32\u4e2d\u7684\u7b2c\u4e00\u4e2a\u5b57\u7b26\nprint(str&#91;2:5])       # \u8f93\u51fa\u5b57\u7b26\u4e32\u4e2d\u7b2c\u4e09\u4e2a\u81f3\u7b2c\u516d\u4e2a\u4e4b\u95f4\u7684\u5b57\u7b26\u4e32\nprint(str&#91;2:])        # \u8f93\u51fa\u4ece\u7b2c\u4e09\u4e2a\u5b57\u7b26\u5f00\u59cb\u7684\u5b57\u7b26\u4e32\nprint(str * 2)        # \u8f93\u51fa\u5b57\u7b26\u4e32\u4e24\u6b21\nprint(str + \"TEST\")   # \u8f93\u51fa\u8fde\u63a5\u7684\u5b57\u7b26\u4e32<\/code><\/pre>\n\n\n\n<p><strong>\u8f93\u51fa\u7ed3\u679c\u5982\u4e0b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Hello World!\nH\nllo\nllo World!\nHello World!Hello World!\nHello World!TEST<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. List\uff08\u5217\u8868\uff09<\/h3>\n\n\n\n<p><code>List<\/code>\uff08\u5217\u8868\uff09 \u662f <code>Python<\/code> \u4e2d\u4f7f\u7528\u6700\u9891\u7e41\u7684\u6570\u636e\u7c7b\u578b<\/p>\n\n\n\n<p>\u5217\u8868\u53ef\u4ee5\u5b8c\u6210\u5927\u591a\u6570\u96c6\u5408\u7c7b\u7684\u6570\u636e\u7ed3\u6784\u5b9e\u73b0\u3002\u5b83\u652f\u6301\u5b57\u7b26\uff0c\u6570\u5b57\uff0c\u5b57\u7b26\u4e32\u751a\u81f3\u53ef\u4ee5\u5305\u542b\u5217\u8868\uff08\u5373\u5d4c\u5957\uff09<\/p>\n\n\n\n<p>\u5217\u8868\u7528 <code>[ ]<\/code> \u6807\u8bc6\uff0c\u662f <code>python<\/code> \u6700\u901a\u7528\u7684\u590d\u5408\u6570\u636e\u7c7b\u578b<\/p>\n\n\n\n<p>\u5217\u8868\u4e2d\u503c\u7684\u5207\u5272\u4e5f\u53ef\u4ee5\u7528\u5230\u53d8\u91cf <code>[\u5934\u4e0b\u6807:\u5c3e\u4e0b\u6807]<\/code> \uff0c\u5c31\u53ef\u4ee5\u622a\u53d6\u76f8\u5e94\u7684\u5217\u8868\uff0c\u4ece\u5de6\u5230\u53f3\u7d22\u5f15\u9ed8\u8ba4 <code>0<\/code> \u5f00\u59cb\uff0c\u4ece\u53f3\u5230\u5de6\u7d22\u5f15\u9ed8\u8ba4 <code>-1<\/code> \u5f00\u59cb\uff0c\u4e0b\u6807\u53ef\u4ee5\u4e3a\u7a7a\u8868\u793a\u53d6\u5230\u5934\u6216\u5c3e<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.garfield-blog.top\/wp-content\/uploads\/2025\/10\/list\u7ed3\u6784.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"1366\" height=\"720\" data-original=\"https:\/\/www.garfield-blog.top\/wp-content\/uploads\/2025\/10\/list\u7ed3\u6784.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-260\"  sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/div><\/figure>\n\n\n\n<p>\u52a0\u53f7 <code>+<\/code> \u662f\u5217\u8868\u8fde\u63a5\u8fd0\u7b97\u7b26\uff0c\u661f\u53f7 <code>*<\/code>\u662f\u91cd\u590d\u64cd\u4f5c<\/p>\n\n\n\n<p><strong>\u5982\u4e0b\u5b9e\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>list = &#91; 'runoob', 786 , 2.23, 'john', 70.2 ]\ntinylist = &#91;123, 'john']\n\nprint(list)                # \u8f93\u51fa\u5b8c\u6574\u5217\u8868\nprint(list&#91;0])             # \u8f93\u51fa\u5217\u8868\u7684\u7b2c\u4e00\u4e2a\u5143\u7d20\nprint(list&#91;1:3])           # \u8f93\u51fa\u7b2c\u4e8c\u4e2a\u81f3\u7b2c\u4e09\u4e2a\u5143\u7d20 \nprint(list&#91;2:])            # \u8f93\u51fa\u4ece\u7b2c\u4e09\u4e2a\u5f00\u59cb\u81f3\u5217\u8868\u672b\u5c3e\u7684\u6240\u6709\u5143\u7d20\nprint(tinylist * 2)        # \u8f93\u51fa\u5217\u8868\u4e24\u6b21\nprint(list + tinylist)     # \u6253\u5370\u7ec4\u5408\u7684\u5217\u8868<\/code><\/pre>\n\n\n\n<p><strong>\u8f93\u51fa\u7ed3\u679c\u5982\u4e0b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;'runoob', 786, 2.23, 'john', 70.2]\nrunoob\n&#91;786, 2.23]\n&#91;2.23, 'john', 70.2]\n&#91;123, 'john', 123, 'john']\n&#91;'runoob', 786, 2.23, 'john', 70.2, 123, 'john']<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Tuple\uff08\u5143\u7ec4\uff09<\/h3>\n\n\n\n<p>\u5143\u7ec4\u662f\u53e6\u4e00\u4e2a\u6570\u636e\u7c7b\u578b\uff0c\u7c7b\u4f3c\u4e8e <code>List<\/code>\uff08\u5217\u8868\uff09<\/p>\n\n\n\n<p>\u5143\u7ec4\u7528 <code>()<\/code> \u6807\u8bc6\u3002\u5185\u90e8\u5143\u7d20\u7528\u9017\u53f7\u9694\u5f00\u3002\u4f46\u662f\u5143\u7ec4\u4e0d\u80fd\u4e8c\u6b21\u8d4b\u503c\uff0c\u76f8\u5f53\u4e8e\u53ea\u8bfb\u5217\u8868<\/p>\n\n\n\n<p><strong>\u5982\u4e0b\u5b9e\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tuple = ( 'runoob', 786 , 2.23, 'john', 70.2 )\ntinytuple = (123, 'john')\n\nprint(tuple)                # \u8f93\u51fa\u5b8c\u6574\u5143\u7ec4\nprint(tuple&#91;0])             # \u8f93\u51fa\u5143\u7ec4\u7684\u7b2c\u4e00\u4e2a\u5143\u7d20\nprint(tuple&#91;1:3])           # \u8f93\u51fa\u7b2c\u4e8c\u4e2a\u81f3\u7b2c\u56db\u4e2a\uff08\u4e0d\u5305\u542b\uff09\u7684\u5143\u7d20 \nprint(tuple&#91;2:])            # \u8f93\u51fa\u4ece\u7b2c\u4e09\u4e2a\u5f00\u59cb\u81f3\u5217\u8868\u672b\u5c3e\u7684\u6240\u6709\u5143\u7d20\nprint(tinytuple * 2)        # \u8f93\u51fa\u5143\u7ec4\u4e24\u6b21\nprint(tuple + tinytuple)    # \u6253\u5370\u7ec4\u5408\u7684\u5143\u7ec4<\/code><\/pre>\n\n\n\n<p><strong>\u8f93\u51fa\u7ed3\u679c\u5982\u4e0b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>('runoob', 786, 2.23, 'john', 70.2)\nrunoob\n(786, 2.23)\n(2.23, 'john', 70.2)\n(123, 'john', 123, 'john')\n('runoob', 786, 2.23, 'john', 70.2, 123, 'john')<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. Dictionary\uff08\u5b57\u5178\uff09<\/h3>\n\n\n\n<p><code>dictionary<\/code>\uff08\u5b57\u5178\uff09\u662f\u9664\u5217\u8868\u4ee5\u5916<code>python<\/code>\u4e4b\u4e2d\u6700\u7075\u6d3b\u7684\u5185\u7f6e\u6570\u636e\u7ed3\u6784\u7c7b\u578b\u3002\u5217\u8868\u662f\u6709\u5e8f\u7684\u5bf9\u8c61\u96c6\u5408\uff0c\u5b57\u5178\u662f\u65e0\u5e8f\u7684\u5bf9\u8c61\u96c6\u5408<\/p>\n\n\n\n<p>\u4e24\u8005\u4e4b\u95f4\u7684\u533a\u522b\u5728\u4e8e\u5b57\u5178\u5f53\u4e2d\u7684\u5143\u7d20\u662f\u901a\u8fc7\u952e\u6765\u5b58\u53d6\u7684\uff0c\u800c\u4e0d\u662f\u901a\u8fc7\u504f\u79fb\u5b58\u53d6<\/p>\n\n\n\n<p>\u5b57\u5178\u7528<code>{ }<\/code>\u6807\u8bc6\uff0c\u5b57\u5178\u7531\u7d22\u5f15<code>key<\/code>\u548c\u5b83\u5bf9\u5e94\u7684\u503c<code>value<\/code>\u7ec4\u6210<\/p>\n\n\n\n<p><strong>\u5982\u4e0b\u5b9e\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dict = {}\ndict&#91;'one'] = \"This is one\"\ndict&#91;2] = \"This is two\"\n\ntinydict = {'name': 'runoob','code':6734, 'dept': 'sales'}\n\n\nprint(dict&#91;'one'])           # \u8f93\u51fa\u952e\u4e3a'one' \u7684\u503c\nprint(dict&#91;2])               # \u8f93\u51fa\u952e\u4e3a 2 \u7684\u503c\nprint(tinydict)              # \u8f93\u51fa\u5b8c\u6574\u7684\u5b57\u5178\nprint(tinydict.keys())       # \u8f93\u51fa\u6240\u6709\u952e\nprint(tinydict.values())     # \u8f93\u51fa\u6240\u6709\u503c<\/code><\/pre>\n\n\n\n<p><strong>\u8f93\u51fa\u7ed3\u679c\u5982\u4e0b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>This is one\nThis is two\n{'name': 'runoob', 'code': 6734, 'dept': 'sales'}\ndict_keys(&#91;'name', 'code', 'dept'])\ndict_values(&#91;'runoob', 6734, 'sales'])<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u8fd0\u7b97\u7b26<\/h2>\n\n\n\n<p><code>Python<\/code>\u8bed\u8a00\u652f\u6301\u4ee5\u4e0b\u7c7b\u578b\u7684\u8fd0\u7b97\u7b26:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u7b97\u672f\u8fd0\u7b97\u7b26<\/li>\n\n\n\n<li>\u6bd4\u8f83\uff08\u5173\u7cfb\uff09\u8fd0\u7b97<\/li>\n\n\n\n<li>\u8d4b\u503c\u8fd0\u7b97\u7b26<\/li>\n\n\n\n<li>\u903b\u8f91\u8fd0\u7b97\u7b26<\/li>\n\n\n\n<li>\u4f4d\u8fd0\u7b97\u7b26<\/li>\n\n\n\n<li>\u6210\u5458\u8fd0\u7b97\u7b26<\/li>\n\n\n\n<li>\u8eab\u4efd\u8fd0\u7b97\u7b26<\/li>\n\n\n\n<li>\u8fd0\u7b97\u7b26\u4f18\u5148\u7ea7<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">\u7b97\u672f\u8fd0\u7b97\u7b26<\/h3>\n\n\n\n<p>\u4ee5\u4e0b\u5047\u8bbe\u53d8\u91cf\uff1a <strong>a=10\uff0cb=20<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u8fd0\u7b97\u7b26<\/th><th>\u63cf\u8ff0<\/th><th>\u5b9e\u4f8b<\/th><\/tr><\/thead><tbody><tr><td><code>+<\/code><\/td><td>\u4e24\u4e2a\u5bf9\u8c61\u76f8\u52a0<\/td><td><code>a + b<\/code> \u8f93\u51fa\u7ed3\u679c <code>30<\/code><\/td><\/tr><tr><td><code>-<\/code><\/td><td>\u5f97\u5230\u8d1f\u6570\u6216\u662f\u4e00\u4e2a\u6570\u51cf\u53bb\u53e6\u4e00\u4e2a\u6570<\/td><td><code>a - b<\/code> \u8f93\u51fa\u7ed3\u679c <code>-10<\/code><\/td><\/tr><tr><td><code>*<\/code><\/td><td>\u4e24\u4e2a\u6570\u76f8\u4e58\u6216\u662f\u8fd4\u56de\u4e00\u4e2a\u88ab\u91cd\u590d\u82e5\u5e72\u6b21\u7684\u5b57\u7b26\u4e32<\/td><td><code>a * b<\/code> \u8f93\u51fa\u7ed3\u679c <code>200<\/code><\/td><\/tr><tr><td><code>\/<\/code><\/td><td>\u9664 <code>x<\/code>\u9664\u4ee5<code>y<\/code><\/td><td><code>b \/ a<\/code> \u8f93\u51fa\u7ed3\u679c <code>2<\/code><\/td><\/tr><tr><td><code>%<\/code><\/td><td>\u8fd4\u56de\u9664\u6cd5\u7684\u4f59\u6570<\/td><td><code>b % a<\/code> \u8f93\u51fa\u7ed3\u679c <code>0<\/code><\/td><\/tr><tr><td><code>**<\/code><\/td><td>\u8fd4\u56de<code>x<\/code>\u7684<code>y<\/code>\u6b21\u5e42<\/td><td><code>a**b<\/code> \u4e3a<code>10<\/code>\u7684<code>20<\/code>\u6b21\u65b9\uff0c \u8f93\u51fa\u7ed3\u679c <code>100000000000000000000<\/code><\/td><\/tr><tr><td><code>\/\/<\/code><\/td><td>\u53d6\u6574\u9664 <code>-<\/code> \u8fd4\u56de\u5546\u7684\u6574\u6570\u90e8\u5206\uff08<strong>\u5411\u4e0b\u53d6\u6574<\/strong>\uff09<\/td><td><code>&gt;&gt;&gt; 9\/\/2 4 &gt;&gt;&gt; -9\/\/2 -5<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u6bd4\u8f83\u8fd0\u7b97\u7b26<\/h3>\n\n\n\n<p>\u4ee5\u4e0b\u5047\u8bbe\u53d8\u91cf <strong>a=10\uff0cb=20<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u8fd0\u7b97\u7b26<\/th><th>\u63cf\u8ff0<\/th><th>\u5b9e\u4f8b<\/th><\/tr><\/thead><tbody><tr><td><code>==<\/code><\/td><td>\u6bd4\u8f83\u5bf9\u8c61\u662f\u5426\u76f8\u7b49<\/td><td><code>(a == b)<\/code> \u8fd4\u56de <code>False<\/code><\/td><\/tr><tr><td><code>!=<\/code><\/td><td>\u6bd4\u8f83\u4e24\u4e2a\u5bf9\u8c61\u662f\u5426\u4e0d\u76f8\u7b49<\/td><td><code>(a != b)<\/code> \u8fd4\u56de <code>True<\/code><\/td><\/tr><tr><td><code>&lt;&gt;<\/code><\/td><td>\u6bd4\u8f83\u4e24\u4e2a\u5bf9\u8c61\u662f\u5426\u4e0d\u76f8\u7b49\u3002<strong>python3 \u5df2\u5e9f\u5f03<\/strong><\/td><td><code>(a &lt;&gt; b)<\/code> \u8fd4\u56de <code>True<\/code>\u3002\u8fd9\u4e2a\u8fd0\u7b97\u7b26\u7c7b\u4f3c <code>!=<\/code><\/td><\/tr><tr><td><code>&gt;<\/code><\/td><td>\u8fd4\u56de<code>x<\/code>\u662f\u5426\u5927\u4e8e<code>y<\/code><\/td><td><code>(a &gt; b)<\/code> \u8fd4\u56de <code>False<\/code><\/td><\/tr><tr><td><code>&lt;<\/code><\/td><td>\u8fd4\u56de<code>x<\/code>\u662f\u5426\u5c0f\u4e8e<code>y<\/code>\u3002\u6240\u6709\u6bd4\u8f83\u8fd0\u7b97\u7b26\u8fd4\u56de<code>1<\/code>\u8868\u793a\u771f\uff0c\u8fd4\u56de0\u8868\u793a\u5047\u3002\u8fd9\u5206\u522b\u4e0e\u7279\u6b8a\u7684\u53d8\u91cf <code>True<\/code> \u548c <code>False<\/code> \u7b49\u4ef7<\/td><td><code>(a &lt; b)<\/code> \u8fd4\u56de <code>True<\/code><\/td><\/tr><tr><td><code>&gt;=<\/code><\/td><td>\u8fd4\u56de<code>x<\/code>\u662f\u5426\u5927\u4e8e\u7b49\u4e8e<code>y<\/code><\/td><td><code>(a &gt;= b)<\/code> \u8fd4\u56de <code>False<\/code><\/td><\/tr><tr><td><code>&lt;=<\/code><\/td><td>\u8fd4\u56de<code>x<\/code>\u662f\u5426\u5c0f\u4e8e\u7b49\u4e8e<code>y<\/code><\/td><td><code>(a &lt;= b)<\/code> \u8fd4\u56de <code>True<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u8d4b\u503c\u8fd0\u7b97\u7b26<\/h3>\n\n\n\n<p>\u4ee5\u4e0b\u5047\u8bbe\u53d8\u91cf<strong>a=10\uff0cb=20<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u8fd0\u7b97\u7b26<\/th><th>\u63cf\u8ff0<\/th><th>\u5b9e\u4f8b<\/th><\/tr><\/thead><tbody><tr><td><code>=<\/code><\/td><td>\u7b80\u5355\u7684\u8d4b\u503c\u8fd0\u7b97\u7b26<\/td><td><code>c = a + b<\/code> \u5c06 <code>a + b<\/code> \u7684\u8fd0\u7b97\u7ed3\u679c\u8d4b\u503c\u4e3a <code>c<\/code><\/td><\/tr><tr><td><code>+=<\/code><\/td><td>\u52a0\u6cd5\u8d4b\u503c\u8fd0\u7b97\u7b26<\/td><td><code>c += a<\/code> \u7b49\u6548\u4e8e <code>c = c + a<\/code><\/td><\/tr><tr><td><code>-=<\/code><\/td><td>\u51cf\u6cd5\u8d4b\u503c\u8fd0\u7b97\u7b26<\/td><td><code>c -= a<\/code> \u7b49\u6548\u4e8e <code>c = c - a<\/code><\/td><\/tr><tr><td><code>*=<\/code><\/td><td>\u4e58\u6cd5\u8d4b\u503c\u8fd0\u7b97\u7b26<\/td><td><code>c *= a<\/code> \u7b49\u6548\u4e8e <code>c = c * a<\/code><\/td><\/tr><tr><td><code>\/=<\/code><\/td><td>\u9664\u6cd5\u8d4b\u503c\u8fd0\u7b97\u7b26<\/td><td><code>c \/= a<\/code> \u7b49\u6548\u4e8e <code>c = c \/ a<\/code><\/td><\/tr><tr><td><code>%=<\/code><\/td><td>\u53d6\u6a21\u8d4b\u503c\u8fd0\u7b97\u7b26<\/td><td><code>c %= a<\/code> \u7b49\u6548\u4e8e <code>c = c % a<\/code><\/td><\/tr><tr><td><code>**=<\/code><\/td><td>\u5e42\u8d4b\u503c\u8fd0\u7b97\u7b26<\/td><td><code>c = a<\/code> \u7b49\u6548\u4e8e <code>c = c ** a<\/code><\/td><\/tr><tr><td><code>\/\/=<\/code><\/td><td>\u53d6\u6574\u9664\u8d4b\u503c\u8fd0\u7b97\u7b26<\/td><td><code>c \/\/= a<\/code> \u7b49\u6548\u4e8e <code>c = c \/\/ a<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u4f4d\u8fd0\u7b97\u7b26<\/h3>\n\n\n\n<p>\u6309\u4f4d\u8fd0\u7b97\u7b26\u662f\u628a\u6570\u5b57\u770b\u4f5c\u4e8c\u8fdb\u5236\u6765\u8fdb\u884c\u8ba1\u7b97\u7684\uff0c<code>Python<\/code>\u4e2d\u7684\u6309\u4f4d\u8fd0\u7b97\u6cd5\u5219\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a = 0011 1100\n\nb = 0000 1101\n\n-----------------\n\na&amp;b = 0000 1100\n\na|b = 0011 1101\n\na^b = 0011 0001\n\n~a  = 1100 0011<\/code><\/pre>\n\n\n\n<p>\u8fd0\u7b97\u7b26\u7c7b\u578b\u5982\u4e0b<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u8fd0\u7b97\u7b26<\/th><th>\u63cf\u8ff0<\/th><th>\u5b9e\u4f8b<\/th><\/tr><\/thead><tbody><tr><td><code>&amp;<\/code><\/td><td>\u6309\u4f4d\u4e0e\u8fd0\u7b97\u7b26\uff1a\u53c2\u4e0e\u8fd0\u7b97\u7684\u4e24\u4e2a\u503c,\u5982\u679c\u4e24\u4e2a\u76f8\u5e94\u4f4d\u90fd\u4e3a<code>1<\/code>,\u5219\u8be5\u4f4d\u7684\u7ed3\u679c\u4e3a<code>1<\/code>,\u5426\u5219\u4e3a<code>0<\/code><\/td><td><code>(a &amp; b)<\/code> \u8f93\u51fa\u7ed3\u679c <code>12<\/code> \uff0c\u4e8c\u8fdb\u5236\u89e3\u91ca\uff1a <code>0000 1100<\/code><\/td><\/tr><tr><td><code>|<\/code><\/td><td>\u6309\u4f4d\u6216\u8fd0\u7b97\u7b26\uff1a\u53ea\u8981\u5bf9\u5e94\u7684\u4e8c\u4e2a\u4e8c\u8fdb\u4f4d\u6709\u4e00\u4e2a\u4e3a<code>1<\/code>\u65f6\uff0c\u7ed3\u679c\u4f4d\u5c31\u4e3a<code>1<\/code><\/td><td><code>(a | b)<\/code> \u8f93\u51fa\u7ed3\u679c <code>61<\/code> \uff0c\u4e8c\u8fdb\u5236\u89e3\u91ca\uff1a <code>0011 1101<\/code><\/td><\/tr><tr><td><code>^<\/code><\/td><td>\u6309\u4f4d\u5f02\u6216\u8fd0\u7b97\u7b26\uff1a\u5f53\u4e24\u5bf9\u5e94\u7684\u4e8c\u8fdb\u4f4d\u76f8\u5f02\u65f6\uff0c\u7ed3\u679c\u4e3a<code>1<\/code><\/td><td><code>(a ^ b)<\/code> \u8f93\u51fa\u7ed3\u679c <code>49<\/code> \uff0c\u4e8c\u8fdb\u5236\u89e3\u91ca\uff1a <code>0011 0001<\/code><\/td><\/tr><tr><td><code>~<\/code><\/td><td>\u6309\u4f4d\u53d6\u53cd\u8fd0\u7b97\u7b26\uff1a\u5c06\u4e8c\u8fdb\u5236\u8868\u793a\u4e2d\u7684\u6bcf\u4e00\u4f4d\u53d6\u53cd\uff0c<code>0<\/code> \u53d8\u4e3a <code>1<\/code>\uff0c<code>1<\/code> \u53d8\u4e3a <code>0<\/code>\u3002<code>~x<\/code> \u7c7b\u4f3c\u4e8e <code>-x-1<\/code><\/td><td><code>(~a )<\/code> \u8f93\u51fa\u7ed3\u679c <code>-61<\/code> \uff0c\u4e8c\u8fdb\u5236\u89e3\u91ca\uff1a <code>1100 0011<\/code> (\u4ee5\u8865\u7801\u5f62\u5f0f\u8868\u793a)\uff0c\u5728\u4e00\u4e2a\u6709\u7b26\u53f7\u4e8c\u8fdb\u5236\u6570\u7684\u8865\u7801\u5f62\u5f0f\u3002<\/td><\/tr><tr><td><code>&lt;&lt;<\/code><\/td><td>\u5de6\u79fb\u52a8\u8fd0\u7b97\u7b26\uff1a\u8fd0\u7b97\u6570\u7684\u5404\u4e8c\u8fdb\u4f4d\u5168\u90e8\u5de6\u79fb\u82e5\u5e72\u4f4d\uff0c\u7531 <code>&lt;&lt;<\/code> \u53f3\u8fb9\u7684\u6570\u5b57\u6307\u5b9a\u4e86\u79fb\u52a8\u7684\u4f4d\u6570\uff0c\u9ad8\u4f4d\u4e22\u5f03\uff0c\u4f4e\u4f4d\u8865<code>0<\/code><\/td><td><code>a &lt;&lt; 2<\/code> \u8f93\u51fa\u7ed3\u679c <code>240<\/code> \uff0c\u4e8c\u8fdb\u5236\u89e3\u91ca\uff1a <code>1111 0000<\/code><\/td><\/tr><tr><td><code>&gt;&gt;<\/code><\/td><td>\u53f3\u79fb\u52a8\u8fd0\u7b97\u7b26\uff1a\u628a<code>&gt;&gt;<\/code>\u5de6\u8fb9\u7684\u8fd0\u7b97\u6570\u7684\u5404\u4e8c\u8fdb\u4f4d\u5168\u90e8\u53f3\u79fb\u82e5\u5e72\u4f4d\uff0c<code>&gt;&gt;<\/code> \u53f3\u8fb9\u7684\u6570\u5b57\u6307\u5b9a\u4e86\u79fb\u52a8\u7684\u4f4d\u6570<\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u903b\u8f91\u8fd0\u7b97\u7b26<\/h3>\n\n\n\n<p><code>Python<\/code>\u8bed\u8a00\u652f\u6301\u903b\u8f91\u8fd0\u7b97\u7b26\uff0c\u4ee5\u4e0b\u5047\u8bbe\u53d8\u91cf <strong>a=10\uff0cb=20<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u8fd0\u7b97\u7b26<\/th><th>\u903b\u8f91\u8868\u8fbe\u5f0f<\/th><th>\u63cf\u8ff0<\/th><th>\u5b9e\u4f8b<\/th><\/tr><\/thead><tbody><tr><td><code>and<\/code><\/td><td><code>x and y<\/code><\/td><td>\u5982\u679c <code>x<\/code> \u4e3a <code>False<\/code>\uff0c<code>x and y<\/code> \u8fd4\u56de False\uff0c\u5426\u5219\u5b83\u8fd4\u56de <code>y<\/code> \u7684\u8ba1\u7b97\u503c<\/td><td><code>(a and b)<\/code> \u8fd4\u56de <code>20<\/code><\/td><\/tr><tr><td><code>or<\/code><\/td><td><code>x or y<\/code><\/td><td>\u5982\u679c <code>x<\/code> \u662f\u975e <code>0<\/code>\uff0c\u5b83\u8fd4\u56de <code>x<\/code> \u7684\u8ba1\u7b97\u503c\uff0c\u5426\u5219\u5b83\u8fd4\u56de <code>y<\/code> \u7684\u8ba1\u7b97\u503c<\/td><td><code>(a or b)<\/code> \u8fd4\u56de <code>10<\/code><\/td><\/tr><tr><td><code>not<\/code><\/td><td><code>not x<\/code><\/td><td>\u5982\u679c <code>x<\/code> \u4e3a <code>True<\/code>\uff0c\u8fd4\u56de <code>False<\/code> \u3002\u5982\u679c <code>x<\/code> \u4e3a <code>False<\/code>\uff0c\u5b83\u8fd4\u56de <code>True<\/code><\/td><td><code>not(a and b)<\/code> \u8fd4\u56de <code>False<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u6210\u5458\u8fd0\u7b97\u7b26<\/h3>\n\n\n\n<p>\u9664\u4e86\u4ee5\u4e0a\u7684\u4e00\u4e9b\u8fd0\u7b97\u7b26\u4e4b\u5916\uff0c<code>Python<\/code>\u8fd8\u652f\u6301\u6210\u5458\u8fd0\u7b97\u7b26\uff0c\u6d4b\u8bd5\u5b9e\u4f8b\u4e2d\u5305\u542b\u4e86\u4e00\u7cfb\u5217\u7684\u6210\u5458\uff0c\u5305\u62ec\u5b57\u7b26\u4e32\uff0c\u5217\u8868\u6216\u5143\u7ec4<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u8fd0\u7b97\u7b26<\/th><th>\u63cf\u8ff0<\/th><th>\u5b9e\u4f8b<\/th><\/tr><\/thead><tbody><tr><td><code>in<\/code><\/td><td>\u5982\u679c\u5728\u6307\u5b9a\u7684\u5e8f\u5217\u4e2d\u627e\u5230\u503c\u8fd4\u56de <code>True<\/code>\uff0c\u5426\u5219\u8fd4\u56de <code>False<\/code><\/td><td><code>x<\/code> \u5728 <code>y<\/code> \u5e8f\u5217\u4e2d , \u5982\u679c <code>x<\/code> \u5728 <code>y<\/code> \u5e8f\u5217\u4e2d\u8fd4\u56de <code>True<\/code><\/td><\/tr><tr><td><code>not in<\/code><\/td><td>\u5982\u679c\u5728\u6307\u5b9a\u7684\u5e8f\u5217\u4e2d\u6ca1\u6709\u627e\u5230\u503c\u8fd4\u56de <code>True<\/code>\uff0c\u5426\u5219\u8fd4\u56de <code>False<\/code><\/td><td><code>x<\/code> \u4e0d\u5728 <code>y<\/code> \u5e8f\u5217\u4e2d , \u5982\u679c <code>x<\/code> \u4e0d\u5728 <code>y<\/code> \u5e8f\u5217\u4e2d\u8fd4\u56de <code>True<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u8eab\u4efd\u8fd0\u7b97\u7b26<\/h3>\n\n\n\n<p>\u8eab\u4efd\u8fd0\u7b97\u7b26\u7528\u4e8e\u6bd4\u8f83\u4e24\u4e2a\u5bf9\u8c61\u7684\u5b58\u50a8\u5355\u5143<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u8fd0\u7b97\u7b26<\/th><th>\u63cf\u8ff0<\/th><th>\u5b9e\u4f8b<\/th><\/tr><\/thead><tbody><tr><td><code>is<\/code><\/td><td><code>is<\/code> \u662f\u5224\u65ad\u4e24\u4e2a\u6807\u8bc6\u7b26\u662f\u4e0d\u662f\u5f15\u7528\u81ea\u4e00\u4e2a\u5bf9\u8c61<\/td><td><code>x is y<\/code> \u7c7b\u4f3c <code>id(x) == id(y)<\/code> , \u5982\u679c\u5f15\u7528\u7684\u662f\u540c\u4e00\u4e2a\u5bf9\u8c61\u5219\u8fd4\u56de <code>True<\/code>\uff0c\u5426\u5219\u8fd4\u56de <code>False<\/code><\/td><\/tr><tr><td><code>is not<\/code><\/td><td><code>is not<\/code> \u662f\u5224\u65ad\u4e24\u4e2a\u6807\u8bc6\u7b26\u662f\u4e0d\u662f\u5f15\u7528\u81ea\u4e0d\u540c\u5bf9\u8c61<\/td><td><code>x is not y<\/code> \uff0c \u7c7b\u4f3c <code>id(a) != id(b)<\/code>\u3002\u5982\u679c\u5f15\u7528\u7684\u4e0d\u662f\u540c\u4e00\u4e2a\u5bf9\u8c61\u5219\u8fd4\u56de\u7ed3\u679c <code>True<\/code>\uff0c\u5426\u5219\u8fd4\u56de <code>False<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u8fd0\u7b97\u7b26\u4f18\u5148\u7ea7<\/h3>\n\n\n\n<p><strong>\u4ee5\u4e0b\u8868\u683c\u5217\u51fa\u4e86\u4ece\u6700\u9ad8\u5230\u6700\u4f4e\u4f18\u5148\u7ea7\u7684\u6240\u6709\u8fd0\u7b97\u7b26\uff1a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u4f18\u5148\u7ea7<\/th><th>\u8fd0\u7b97\u7b26<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>1(\u6700\u9ad8\u4f18\u5148\u7ea7)<\/td><td><code>**<\/code><\/td><td>\u6307\u6570<\/td><\/tr><tr><td>2<\/td><td><code>~ + -<\/code><\/td><td>\u6309\u4f4d\u7ffb\u8f6c, \u4e00\u5143\u52a0\u53f7\u548c\u51cf\u53f7 (\u6700\u540e\u4e24\u4e2a\u7684\u65b9\u6cd5\u540d\u4e3a <code>+@<\/code> \u548c <code>-@<\/code>)<\/td><\/tr><tr><td>3<\/td><td><code>* \/ % \/\/<\/code><\/td><td>\u4e58\uff0c\u9664\uff0c\u53d6\u6a21\u548c\u53d6\u6574\u9664<\/td><\/tr><tr><td>4<\/td><td><code>+ -<\/code><\/td><td>\u52a0\u6cd5\u51cf\u6cd5<\/td><\/tr><tr><td>5<\/td><td><code>&gt;&gt; &lt;&lt;<\/code><\/td><td>\u53f3\u79fb\uff0c\u5de6\u79fb\u8fd0\u7b97\u7b26<\/td><\/tr><tr><td>6<\/td><td><code>&amp;<\/code><\/td><td>\u4f4d <code>AND<\/code><\/td><\/tr><tr><td>7<\/td><td><code>^ |<\/code><\/td><td>\u4f4d\u8fd0\u7b97\u7b26<\/td><\/tr><tr><td>8<\/td><td><code>&lt;= &lt; &gt; &gt;=<\/code><\/td><td>\u6bd4\u8f83\u8fd0\u7b97\u7b26<\/td><\/tr><tr><td>9<\/td><td><code>&lt;&gt; == !=<\/code><\/td><td>\u7b49\u4e8e\u8fd0\u7b97\u7b26<\/td><\/tr><tr><td>10<\/td><td><code>= %= \/= \/\/= -= += *= **=<\/code><\/td><td>\u8d4b\u503c\u8fd0\u7b97\u7b26<\/td><\/tr><tr><td>11<\/td><td><code>is is not<\/code><\/td><td>\u8eab\u4efd\u8fd0\u7b97\u7b26<\/td><\/tr><tr><td>12<\/td><td><code>in not in<\/code><\/td><td>\u6210\u5458\u8fd0\u7b97\u7b26<\/td><\/tr><tr><td>13<\/td><td><code>not and or<\/code><\/td><td>\u903b\u8f91\u8fd0\u7b97\u7b26<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u6d41\u7a0b\u8bed\u53e5<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u6761\u4ef6\u8bed\u53e5<\/h3>\n\n\n\n<p><code>python<\/code>\u4e2d\u7684\u6761\u4ef6\u8bed\u53e5\u4e0e\u5927\u90e8\u5206\u7f16\u7a0b\u8bed\u8a00\u4e00\u81f4<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if \u5224\u65ad\u6761\u4ef6\uff1a\n    \u6267\u884c\u8bed\u53e5\u2026\u2026\nelse\uff1a\n    \u6267\u884c\u8bed\u53e5\u2026\u2026<\/code><\/pre>\n\n\n\n<p><strong>\u5b9e\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u4f8b1\uff1aif \u57fa\u672c\u7528\u6cd5\n\nflag = False\nname = 'luren'\nif name == 'python':         # \u5224\u65ad\u53d8\u91cf\u662f\u5426\u4e3a python \n    flag = True              # \u6761\u4ef6\u6210\u7acb\u65f6\u8bbe\u7f6e\u6807\u5fd7\u4e3a\u771f\n    print 'welcome boss'     # \u5e76\u8f93\u51fa\u6b22\u8fce\u4fe1\u606f\nelse:\n    print name               # \u6761\u4ef6\u4e0d\u6210\u7acb\u65f6\u8f93\u51fa\u53d8\u91cf\u540d\u79f0<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u5faa\u73af\u8bed\u53e5<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">while\u5faa\u73af<\/h4>\n\n\n\n<p><code>python<\/code>\u4e2d\u7684<code>while<\/code>\u4e0e\u5927\u90e8\u5206\u7f16\u7a0b\u8bed\u8a00\u4e00\u6837<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>while \u5224\u65ad\u6761\u4ef6(condition)\uff1a\n    \u6267\u884c\u8bed\u53e5(statements)\u2026\u2026<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">for\u5faa\u73af<\/h4>\n\n\n\n<p><code>python<\/code>\u4e2d\u7684<code>for<\/code>\u5faa\u73af\u53ef\u4ee5\u7528\u4e8e\u904d\u5386\u53ef\u8fed\u4ee3\u5bf9\u8c61\u4e2d\u7684\u6240\u6709\u5143\u7d20\uff0c\u4f8b\u5982\u5217\u8868\u3001\u5143\u7ec4\u3001\u5b57\u7b26\u4e32\u7b49<\/p>\n\n\n\n<p><strong>\u5f62\u5f0f\u5982\u4e0b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>for iterating_var in sequence:\n   statements(s)<\/code><\/pre>\n\n\n\n<p><strong>\u5b9e\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>for letter in 'Python':     # \u7b2c\u4e00\u4e2a\u5b9e\u4f8b\n   print(\"\u5f53\u524d\u5b57\u6bcd: %s\" % letter)\n'''\n\u8fd0\u884c\u7ed3\u679c\uff1a\n\n\u5f53\u524d\u5b57\u6bcd: P\n\u5f53\u524d\u5b57\u6bcd: y\n\u5f53\u524d\u5b57\u6bcd: t\n\u5f53\u524d\u5b57\u6bcd: h\n\u5f53\u524d\u5b57\u6bcd: o\n\u5f53\u524d\u5b57\u6bcd: n\n'''\n\nfruits = &#91;'banana', 'apple',  'mango']\nfor fruit in fruits:        # \u7b2c\u4e8c\u4e2a\u5b9e\u4f8b\n   print ('\u5f53\u524d\u6c34\u679c: %s'% fruit)\n'''\n\u8fd0\u884c\u7ed3\u679c\uff1a\n\n\u5f53\u524d\u6c34\u679c: banana\n\u5f53\u524d\u6c34\u679c: apple\n\u5f53\u524d\u6c34\u679c: mango\n'''<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u51fd\u6570\u5b9a\u4e49<\/h2>\n\n\n\n<p>\u51fd\u6570\u5b9a\u4e49\u65f6\u9700\u8981\u9075\u5b88\u4e0b\u9762\u7684\u89c4\u5219<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u51fd\u6570\u4ee3\u7801\u5757\u4ee5 <strong>def<\/strong> \u5173\u952e\u8bcd\u5f00\u5934\uff0c\u540e\u63a5\u51fd\u6570\u6807\u8bc6\u7b26\u540d\u79f0\u548c\u5706\u62ec\u53f7<strong>()<\/strong><\/li>\n\n\n\n<li>\u4efb\u4f55\u4f20\u5165\u53c2\u6570\u548c\u81ea\u53d8\u91cf\u5fc5\u987b\u653e\u5728\u5706\u62ec\u53f7\u4e2d\u95f4\u3002\u5706\u62ec\u53f7\u4e4b\u95f4\u53ef\u4ee5\u7528\u4e8e\u5b9a\u4e49\u53c2\u6570<\/li>\n\n\n\n<li>\u51fd\u6570\u7684\u7b2c\u4e00\u884c\u8bed\u53e5\u53ef\u4ee5\u9009\u62e9\u6027\u5730\u4f7f\u7528\u6587\u6863\u5b57\u7b26\u4e32\u2014\u7528\u4e8e\u5b58\u653e\u51fd\u6570\u8bf4\u660e<\/li>\n\n\n\n<li>\u51fd\u6570\u5185\u5bb9\u4ee5\u5192\u53f7\u8d77\u59cb\uff0c\u5e76\u4e14\u7f29\u8fdb<\/li>\n\n\n\n<li><strong>return [\u8868\u8fbe\u5f0f]<\/strong> \u7ed3\u675f\u51fd\u6570\uff0c\u9009\u62e9\u6027\u5730\u8fd4\u56de\u4e00\u4e2a\u503c\u7ed9\u8c03\u7528\u65b9\u3002\u4e0d\u5e26\u8868\u8fbe\u5f0f\u7684<code>return<\/code>\u76f8\u5f53\u4e8e\u8fd4\u56de<code>None<\/code><\/li>\n<\/ul>\n\n\n\n<p><strong>\u5b9e\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/usr\/bin\/python\n# -*- coding: UTF-8 -*-\n\n# \u5b9a\u4e49\u51fd\u6570\ndef printme( str ):\n   \"\u6253\u5370\u4efb\u4f55\u4f20\u5165\u7684\u5b57\u7b26\u4e32\"\n   print str\n   return\n\n# \u8c03\u7528\u51fd\u6570\nprintme(\"\u6211\u8981\u8c03\u7528\u7528\u6237\u81ea\u5b9a\u4e49\u51fd\u6570!\")\nprintme(\"\u518d\u6b21\u8c03\u7528\u540c\u4e00\u51fd\u6570\")<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u5f02\u5e38\u5904\u7406<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">try\\except\u8bed\u53e5<\/h3>\n\n\n\n<p><strong>\u6574\u4f53\u6d41\u7a0b\u5982\u4e0b\u56fe\uff1a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.garfield-blog.top\/wp-content\/uploads\/2025\/10\/try_except.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"490\" height=\"334\" data-original=\"https:\/\/www.garfield-blog.top\/wp-content\/uploads\/2025\/10\/try_except.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-261\"\/><\/div><\/figure>\n\n\n\n<p><strong>try \u8bed\u53e5\u6309\u7167\u5982\u4e0b\u65b9\u5f0f\u5de5\u4f5c\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u9996\u5148\uff0c\u6267\u884c <code>try<\/code> \u5b50\u53e5\uff08\u5728\u5173\u952e\u5b57 <code>try<\/code> \u548c\u5173\u952e\u5b57 <code>except<\/code> \u4e4b\u95f4\u7684\u8bed\u53e5\uff09<\/li>\n\n\n\n<li>\u5982\u679c\u6ca1\u6709\u5f02\u5e38\u53d1\u751f\uff0c\u5ffd\u7565 <code>except<\/code> \u5b50\u53e5\uff0c<code>try<\/code> \u5b50\u53e5\u6267\u884c\u540e\u7ed3\u675f<\/li>\n\n\n\n<li>\u5982\u679c\u5728\u6267\u884c <code>try<\/code> \u5b50\u53e5\u7684\u8fc7\u7a0b\u4e2d\u53d1\u751f\u4e86\u5f02\u5e38\uff0c\u90a3\u4e48 <code>try<\/code> \u5b50\u53e5\u4f59\u4e0b\u7684\u90e8\u5206\u5c06\u88ab\u5ffd\u7565\u3002\u5982\u679c\u5f02\u5e38\u7684\u7c7b\u578b\u548c <code>except<\/code> \u4e4b\u540e\u7684\u540d\u79f0\u76f8\u7b26\uff0c\u90a3\u4e48\u5bf9\u5e94\u7684 <code>except<\/code> \u5b50\u53e5\u5c06\u88ab\u6267\u884c<\/li>\n\n\n\n<li>\u5982\u679c\u4e00\u4e2a\u5f02\u5e38\u6ca1\u6709\u4e0e\u4efb\u4f55\u7684 <code>except<\/code> \u5339\u914d\uff0c\u90a3\u4e48\u8fd9\u4e2a\u5f02\u5e38\u5c06\u4f1a\u4f20\u9012\u7ed9\u4e0a\u5c42\u7684 <code>try<\/code> \u4e2d<\/li>\n<\/ul>\n\n\n\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>try:\n    fh = open(\"testfile\", \"w\")\n    fh.write(\"\u8fd9\u662f\u4e00\u4e2a\u6d4b\u8bd5\u6587\u4ef6\uff0c\u7528\u4e8e\u6d4b\u8bd5\u5f02\u5e38!!\")\nexcept IOError:\n    print \"Error: \u6ca1\u6709\u627e\u5230\u6587\u4ef6\u6216\u8bfb\u53d6\u6587\u4ef6\u5931\u8d25\"<\/code><\/pre>\n\n\n\n<p><strong><code>try<\/code>\u8bed\u53e5\u540e\u4e5f\u53ef\u4ee5\u52a0\u4e0aelse\u8bed\u53e5\uff0c\u5982\u679ctry\u4e2d\u7684\u6267\u884c\u8bed\u53e5\u6ca1\u6709\u53d1\u751f\u5f02\u5e38\u5219\u6267\u884celse\u4e2d\u7684\u8bed\u53e5<\/strong><\/p>\n\n\n\n<p><strong>\u6574\u4f53\u6d41\u7a0b\u5982\u4e0b\u56fe\uff1a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.garfield-blog.top\/wp-content\/uploads\/2025\/10\/try_except_else.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"505\" height=\"433\" data-original=\"https:\/\/www.garfield-blog.top\/wp-content\/uploads\/2025\/10\/try_except_else.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-262\"\/><\/div><\/figure>\n\n\n\n<p><strong>\u4f8b\u5982\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>try:\n    fh = open(\"testfile\", \"w\")\n    fh.write(\"\u8fd9\u662f\u4e00\u4e2a\u6d4b\u8bd5\u6587\u4ef6\uff0c\u7528\u4e8e\u6d4b\u8bd5\u5f02\u5e38!!\")\nexcept IOError:\n    print \"Error: \u6ca1\u6709\u627e\u5230\u6587\u4ef6\u6216\u8bfb\u53d6\u6587\u4ef6\u5931\u8d25\"\nelse:\n    print \"\u5185\u5bb9\u5199\u5165\u6587\u4ef6\u6210\u529f\"\n    fh.close()<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">except \u2026 as \u2026\u8bed\u53e5<\/h3>\n\n\n\n<p><code>except ... as ...<\/code> &#8211; \u6355\u83b7\u5f02\u5e38\u5e76\u7ed1\u5b9a\u5230\u53d8\u91cf\uff0c<code>except<\/code>\u8bed\u53e5\u4ec5\u4f1a\u6355\u83b7\u5f02\u5e38\u800c\u4e0d\u8fdb\u884c\u7ed1\u5b9a\u3002\u5f53\u9700\u8981\u8bbf\u95ee\u5f02\u5e38\u5bf9\u8c61\u7684\u8be6\u7ec6\u4fe1\u606f\uff08\u5982\u9519\u8bef\u6d88\u606f\u3001\u9519\u8bef\u7c7b\u578b\u7b49\uff09\u65f6\u4f7f\u7528<\/p>\n\n\n\n<p><strong>\u5b9e\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>try:# \u4e00\u4e9b\u53ef\u80fd\u51fa\u9519\u7684\u4ee3\u7801\n  result = 10 \/ 0\nexcept Exception as e:\n  print(f\"\u53d1\u751f\u4e86\u9664\u96f6\u9519\u8bef: {e}\")\n  print(f\"\u5f02\u5e38\u7c7b\u578b: {type(e)}\")<\/code><\/pre>\n\n\n\n<p><code>except ... as ...<\/code>\u8bed\u53e5\u4f1a\u5c06\u6355\u6349\u5230\u7684\u9519\u8bef\u7ed1\u5b9a\u5230\u53d8\u91cf<code>e<\/code>\uff0c\u65b9\u4fbf\u518d\u540e\u7eed\u7684\u6d41\u7a0b\u4e2d\u5c06\u8fd9\u4e2a\u9519\u8bef\u6253\u5370\u51fa\u6765<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">except* \u8bed\u53e5<\/h3>\n\n\n\n<p><code>except*<\/code> \u662f<code>Python 3.11<\/code>\u5f15\u5165\u7684\u65b0\u8bed\u6cd5\uff0c\u7528\u4e8e\u5904\u7406<strong>\u5f02\u5e38\u7ec4<\/strong>\u3002<code>except<\/code> \u8bed\u53e5\u53ea\u80fd\u5904\u7406\u5355\u4e2a\u5f02\u5e38\uff0c<code>except*<\/code>\u5219\u53ef\u4ee5\u5904\u7406\u591a\u4e2a\u540c\u65f6\u53d1\u751f\u7684\u5f02\u5e38\u901a\u5e38\u4e0e <code>ExceptionGroup<\/code> \u6216 <code>BaseExceptionGroup<\/code> \u4e00\u8d77\u4f7f\u7528<\/p>\n\n\n\n<p><strong>\u4f7f\u7528\u573a\u666f<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>except<\/code> \u9002\u7528\u4e8e\uff1a<\/li>\n\n\n\n<li>\u4f20\u7edf\u7684\u5355\u7ebf\u7a0b\u3001\u987a\u5e8f\u6267\u884c\u7684\u4ee3\u7801<\/li>\n\n\n\n<li>\u4e00\u6b21\u53ea\u53ef\u80fd\u53d1\u751f\u4e00\u4e2a\u5f02\u5e38\u7684\u60c5\u51b5<\/li>\n\n\n\n<li><code>except*<\/code> \u9002\u7528\u4e8e\uff1a<\/li>\n\n\n\n<li>\u5e76\u53d1\u7f16\u7a0b\uff08\u5982 <code>asyncio.gather()<\/code>\uff09<\/li>\n\n\n\n<li>\u9700\u8981\u540c\u65f6\u5904\u7406\u591a\u4e2a\u76f8\u5173\u5f02\u5e38\u7684\u573a\u666f<\/li>\n\n\n\n<li>\u6279\u91cf\u64cd\u4f5c\u4e2d\u90e8\u5206\u5931\u8d25\u7684\u60c5\u51b5<\/li>\n<\/ul>\n\n\n\n<p><strong>\u5b9e\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import asyncio\n\nasync def failing_task(n):\n    if n == 1:\n        raise ValueError(f\"\u503c\u9519\u8bef {n}\")\n    elif n == 2:\n        raise TypeError(f\"\u7c7b\u578b\u9519\u8bef {n}\")\n    else:\n        return f\"\u6210\u529f {n}\"\n\nasync def main():\n    try:\n        # \u5e76\u53d1\u6267\u884c\u591a\u4e2a\u4efb\u52a1\uff0c\u5176\u4e2d\u4e00\u4e9b\u4f1a\u5931\u8d25\n        results = await asyncio.gather(\n            failing_task(1),\n            failing_task(2), \n            failing_task(3),\n            return_exceptions=True\n        )\n    except* ValueError as eg:\n        print(f\"\u5904\u7406\u6240\u6709\u503c\u9519\u8bef: {len(eg.exceptions)} \u4e2a\")\n    except* TypeError as eg:\n        print(f\"\u5904\u7406\u6240\u6709\u7c7b\u578b\u9519\u8bef: {len(eg.exceptions)} \u4e2a\")<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">finally \u8bed\u53e5<\/h3>\n\n\n\n<p><code>finally<\/code>\u5b57\u53e5\u4e2d\u7684\u8bed\u53e5\u65e0\u8bba\u53d1\u751f\u4e86\u4ec0\u4e48\u6700\u540e\u90fd\u4f1a\u88ab\u6267\u884c<\/p>\n\n\n\n<p><strong>\u6574\u4f53\u6d41\u7a0b\u5982\u4e0b\u56fe\uff1a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.garfield-blog.top\/wp-content\/uploads\/2025\/10\/finally\u8bed\u53e5.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"688\" height=\"508\" data-original=\"https:\/\/www.garfield-blog.top\/wp-content\/uploads\/2025\/10\/finally\u8bed\u53e5.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-259\"\/><\/div><\/figure>\n\n\n\n<p><strong>\u9700\u8981\u6ce8\u610f\u7684\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5b8c\u6574\u7684\u683c\u5f0f\u987a\u5e8f\u662f\uff1a<code>try \u2014&gt; except X \u2014&gt; except \u2014&gt; else\u2014&gt; finally<\/code><\/li>\n\n\n\n<li>\u5982\u679c<code>else<\/code>\u548c<code>finally<\/code>\u90fd\u5b58\u5728\u7684\u8bdd\uff0c<code>else<\/code>\u5fc5\u987b\u5728<code>finally<\/code>\u4e4b\u524d\uff0c<code>finally<\/code>\u5fc5\u987b\u5728\u6574\u4e2a\u7a0b\u5e8f\u7684\u6700\u540e<\/li>\n<\/ul>\n\n\n\n<p><strong>\u4f8b\u5982\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>try:\n    Nomal execution block\nexcept A:\n    Exception A handle\nexcept B:\n    Exception B handle\nexcept:\n    Other Exception handle\nelse:\n    if no exception, get here\nfinally:\n    print('finally')<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u5185\u7f6e\u5f02\u5e38\u7c7b\u578b<\/h2>\n\n\n\n<p>\u5185\u7f6e\u5f02\u5e38\u7c7b\u578b\u7684\u8be6\u7ec6\u8bf4\u660e\u89c1<code>python3<\/code>\u5b98\u65b9\u6587\u6863\uff0c\u672c\u6587\u4e0d\u505a\u8d58\u8ff0<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>[<a href=\"https:\/\/docs.python.org\/zh-cn\/3.13\/library\/exceptions.html#bltin-exceptions\">\u5185\u7f6e\u5f02\u5e38 \u2014 Python 3.13.5 \u6587\u6863<\/a>]:<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">\u9632\u6b62\u91cd\u590d\u5305\u542b<\/h2>\n\n\n\n<p><code>python<\/code>\u4e2d\u5f53\u628a\u6a21\u5757<code>A<\/code>\u4e2d\u7684\u4ee3\u7801\u5728\u6a21\u5757<code>B<\/code>\u4e2d\u8fdb\u884c<code>import A<\/code>\u65f6\uff0c\u53ea\u8981<code>B<\/code>\u6a21\u5757\u4ee3\u7801\u8fd0\u884c\u5230\u8be5<code>import<\/code>\u8bed\u53e5\uff0c\u6a21\u5757<code>A<\/code>\u7684\u4ee3\u7801\u4f1a\u88ab\u6267\u884c\uff0c\u4e3a\u4e86\u7a0b\u5e8f\u88ab\u9632\u6b62\u91cd\u590d\u6267\u884c\u540c\u65f6\u4e5f\u662f\u4fdd\u8bc1\u7a0b\u5e8f\u53ea\u6709\u4e00\u4e2a\u552f\u4e00\u7684\u5165\u53e3\uff0c\u901a\u5e38\u4f1a\u5728\u7a0b\u5e8f\u7684\u5165\u53e3\u5904\u52a0\u4e0a<code>if __name__ == \"__main__\":<\/code>\u7684\u8bed\u53e5<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if __name__ == \"__main__\":\n    main()<\/code><\/pre>\n\n\n\n<p>\u54ea\u4e2a\u6a21\u5757\u88ab\u76f4\u63a5\u6267\u884c\u65f6\uff0c\u8be5\u6a21\u5757<code>__name__<\/code>\u7684\u503c\u5c31\u662f<code>__main__<\/code>\uff0c\u5f53\u88ab\u5bfc\u5165\u53e6\u4e00\u6a21\u5757\u65f6\uff0c<code>__name__<\/code>\u7684\u503c\u5c31\u662f\u6a21\u5757\u7684\u771f\u5b9e\u540d\u79f0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python \u662f\u4e00\u4e2a\u9ad8\u5c42\u6b21\u7684\u7ed3\u5408\u4e86\u89e3\u91ca\u6027\u3001\u7f16\u8bd1\u6027\u3001\u4e92\u52a8\u6027\u548c\u9762\u5411\u5bf9\u8c61\u7684\u811a\u672c\u8bed\u8a00\u3002\u4e0d\u540c\u4e8eC\/C++\u8bed\u8a00\u9700\u8981\u7f16\u8bd1\u6210\u53ef [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[7],"tags":[],"class_list":["post-128","post","type-post","status-publish","format-standard","hentry","category-learning-programming-languages"],"_links":{"self":[{"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=\/wp\/v2\/posts\/128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=128"}],"version-history":[{"count":4,"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=\/wp\/v2\/posts\/128\/revisions"}],"predecessor-version":[{"id":264,"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=\/wp\/v2\/posts\/128\/revisions\/264"}],"wp:attachment":[{"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}