{"id":77356,"date":"2026-02-24T14:17:40","date_gmt":"2026-02-24T06:17:40","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/77356.html"},"modified":"2026-02-24T14:17:40","modified_gmt":"2026-02-24T06:17:40","slug":"%e7%ac%ac%e4%b8%89%e7%ab%a0%ef%bd%9c%e8%bf%90%e7%ae%97%e7%ac%a6%e4%b8%8e%e8%a1%a8%e8%be%be%e5%bc%8f%ef%bc%9a%e8%ae%a9-python-%e5%b8%ae%e4%bd%a0%e7%ae%97%e8%b4%a6","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/77356.html","title":{"rendered":"\u7b2c\u4e09\u7ae0\uff5c\u8fd0\u7b97\u7b26\u4e0e\u8868\u8fbe\u5f0f\uff1a\u8ba9 Python \u5e2e\u4f60\u7b97\u8d26"},"content":{"rendered":"<hr \/>\n<h3>&#x1f4cc; \u5f15\u8a00&#xff1a;\u7f16\u7a0b\u5c31\u662f\u201c\u7b97\u8d26\u201d<\/h3>\n<p>\u4f60\u5199\u4ee3\u7801\u662f\u4e3a\u4e86\u4ec0\u4e48&#xff1f;\u5f52\u6839\u7ed3\u5e95&#xff0c;\u662f\u4e3a\u4e86\u5904\u7406\u6570\u636e\u2014\u2014\u628a\u4e00\u5806\u6570\u5b57\u3001\u5b57\u7b26\u4e32\u3001\u5e03\u5c14\u503c\u7ecf\u8fc7\u5404\u79cd\u8fd0\u7b97&#xff0c;\u53d8\u6210\u4f60\u60f3\u8981\u7684\u7ed3\u679c\u3002\u800c\u201c\u8fd0\u7b97\u201d\u9760\u7684\u5c31\u662f\u8fd0\u7b97\u7b26\u3002<\/p>\n<p>\u60f3\u8c61\u4e00\u4e0b\u53bb\u8d85\u5e02\u8d2d\u7269&#xff1a;<\/p>\n<ul>\n<li>\u4e70\u4e86 3 \u4e2a\u82f9\u679c&#xff0c;\u6bcf\u4e2a 5 \u5143 \u2192 3 * 5&#xff08;\u7b97\u672f&#xff09;<\/li>\n<li>\u6ee1 100 \u51cf 20 \u2192 \u603b\u4ef7\u662f\u5426 \u2265100&#xff1f;&#xff08;\u6bd4\u8f83&#xff09;<\/li>\n<li>\u4f1a\u5458\u518d\u6253 9 \u6298 \u2192 if \u4f1a\u5458 and \u603b\u4ef7 &gt; 50&#xff08;\u903b\u8f91&#xff09;<\/li>\n<\/ul>\n<p>\u8fd0\u7b97\u7b26\u5c31\u662f\u7f16\u7a0b\u8bed\u8a00\u7684\u201c\u52a8\u8bcd\u201d\u3002\u638c\u63e1\u5b83\u4eec&#xff0c;\u4f60\u7684\u7a0b\u5e8f\u624d\u80fd\u771f\u6b63\u201c\u52a8\u201d\u8d77\u6765\u3002<\/p>\n<p>\u672c\u7ae0\u6211\u4eec\u5c31\u6765\u5f7b\u5e95\u641e\u61c2 Python \u4e2d\u7684\u5404\u79cd\u8fd0\u7b97\u7b26&#xff0c;\u4ece\u52a0\u51cf\u4e58\u9664\u5230\u8eab\u4efd\u6bd4\u8f83&#xff0c;\u5e76\u5b66\u4f1a\u5982\u4f55\u4f18\u96c5\u5730\u7ec4\u5408\u5b83\u4eec\u3002<\/p>\n<hr \/>\n<h2>\u4e00\u3001\u7b97\u672f\u8fd0\u7b97\u7b26&#xff1a;\u6570\u5b66\u8bfe\u4ee3\u8868<\/h2>\n<p>Python \u652f\u6301\u57fa\u672c\u7684\u6570\u5b66\u8fd0\u7b97&#xff0c;\u800c\u4e14\u6709\u4e9b\u8fd0\u7b97\u7b26\u6bd4\u5176\u4ed6\u8bed\u8a00\u66f4\u8d34\u5fc3\u3002<\/p>\n<table>\n<tr>\u8fd0\u7b97\u7b26\u542b\u4e49\u793a\u4f8b\u7ed3\u679c<\/tr>\n<tbody>\n<tr>\n<td>&#043;<\/td>\n<td>\u52a0\u6cd5<\/td>\n<td>10 &#043; 3<\/td>\n<td>13<\/td>\n<\/tr>\n<tr>\n<td>&#8211;<\/td>\n<td>\u51cf\u6cd5<\/td>\n<td>10 &#8211; 3<\/td>\n<td>7<\/td>\n<\/tr>\n<tr>\n<td>*<\/td>\n<td>\u4e58\u6cd5<\/td>\n<td>10 * 3<\/td>\n<td>30<\/td>\n<\/tr>\n<tr>\n<td>\/<\/td>\n<td>\u6d6e\u70b9\u9664\u6cd5<\/td>\n<td>10 \/ 3<\/td>\n<td>3.3333333333333335<\/td>\n<\/tr>\n<tr>\n<td>\/\/<\/td>\n<td>\u6574\u9664&#xff08;\u5730\u677f\u9664&#xff09;<\/td>\n<td>10 \/\/ 3<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>%<\/td>\n<td>\u53d6\u4f59&#xff08;\u6a21\u8fd0\u7b97&#xff09;<\/td>\n<td>10 % 3<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>**<\/td>\n<td>\u5e42\u8fd0\u7b97<\/td>\n<td>2 ** 3<\/td>\n<td>8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>&#x1f4cc; \u7279\u522b\u5173\u6ce8&#xff1a;\u9664\u6cd5\u8fd0\u7b97\u7b26<\/h3>\n<p>\u5f88\u591a\u8bed\u8a00\u91cc&#xff0c;\u6574\u6570\u76f8\u9664\u7ed3\u679c\u8fd8\u662f\u6574\u6570&#xff08;\u622a\u65ad&#xff09;&#xff0c;\u4f46 Python \u7684 \/ \u6c38\u8fdc\u8fd4\u56de\u6d6e\u70b9\u6570\u3002\u5982\u679c\u4f60\u60f3\u8981\u6574\u6570\u7ed3\u679c&#xff0c;\u5f97\u7528 \/\/\u3002<\/p>\n<p><span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">5<\/span> <span class=\"token operator\">\/<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># 2.5<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">5<\/span> <span class=\"token operator\">\/\/<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span>  <span class=\"token comment\"># 2<\/span><\/p>\n<p>\u26a0\ufe0f \u6ce8\u610f\u8d1f\u6570\u7684 \/\/ \u662f\u5411\u4e0b\u53d6\u6574&#xff08;\u4e0d\u662f\u5411\u96f6\u53d6\u6574&#xff09;&#xff1a;<\/p>\n<p><span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">&#8211;<\/span><span class=\"token number\">5<\/span> <span class=\"token operator\">\/\/<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span>  <span class=\"token comment\"># -3&#xff0c;\u56e0\u4e3a -2.5 \u5411\u4e0b\u53d6\u6574\u662f -3<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">&#8211;<\/span><span class=\"token number\">5<\/span> <span class=\"token operator\">\/<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># -2.5<\/span><\/p>\n<p>\u53d6\u4f59 % \u9075\u5faa\u516c\u5f0f&#xff1a;a &#061; (a \/\/ b) * b &#043; (a % b)&#xff0c;\u6240\u4ee5\u7ed3\u679c\u7684\u6b63\u8d1f\u4e0e\u9664\u6570\u6709\u5173&#xff1a;<\/p>\n<p><span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">&#8211;<\/span><span class=\"token number\">5<\/span> <span class=\"token operator\">%<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># 1&#xff0c;\u56e0\u4e3a -5 &#061; (-3)*2 &#043; 1<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">5<\/span> <span class=\"token operator\">%<\/span> <span class=\"token operator\">&#8211;<\/span><span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># -1&#xff0c;\u56e0\u4e3a 5 &#061; (-2)*(-2) &#043; (-1)<\/span><\/p>\n<hr \/>\n<h3>\u2728 \u51b7\u77e5\u8bc6&#xff1a;\u8fd0\u7b97\u7b26\u4e5f\u80fd\u7528\u5728\u5b57\u7b26\u4e32\u4e0a<\/h3>\n<ul>\n<li>&#043; \u53ef\u4ee5\u62fc\u63a5\u5b57\u7b26\u4e32<\/li>\n<li>* \u53ef\u4ee5\u91cd\u590d\u5b57\u7b26\u4e32<\/li>\n<\/ul>\n<p><span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Hello&#034;<\/span> <span class=\"token operator\">&#043;<\/span> <span class=\"token string\">&#034; &#034;<\/span> <span class=\"token operator\">&#043;<\/span> <span class=\"token string\">&#034;World&#034;<\/span><span class=\"token punctuation\">)<\/span>  <span class=\"token comment\"># Hello World<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Ha&#034;<\/span> <span class=\"token operator\">*<\/span> <span class=\"token number\">3<\/span><span class=\"token punctuation\">)<\/span>                  <span class=\"token comment\"># HaHaHa<\/span><\/p>\n<p>\u4f46 -\u3001\/ \u7b49\u5bf9\u5b57\u7b26\u4e32\u65e0\u6548&#xff0c;\u522b\u778e\u8bd5\u3002<\/p>\n<hr \/>\n<h2>\u4e8c\u3001\u6bd4\u8f83\u8fd0\u7b97\u7b26&#xff1a;\u771f\u5047\u7f8e\u7334\u738b<\/h2>\n<p>\u6bd4\u8f83\u8fd0\u7b97\u7b26\u8fd4\u56de\u5e03\u5c14\u503c True \u6216 False\u3002<\/p>\n<table>\n<tr>\u8fd0\u7b97\u7b26\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>&#061;&#061;<\/td>\n<td>\u7b49\u4e8e<\/td>\n<\/tr>\n<tr>\n<td>!&#061;<\/td>\n<td>\u4e0d\u7b49\u4e8e<\/td>\n<\/tr>\n<tr>\n<td>&gt;<\/td>\n<td>\u5927\u4e8e<\/td>\n<\/tr>\n<tr>\n<td>&lt;<\/td>\n<td>\u5c0f\u4e8e<\/td>\n<\/tr>\n<tr>\n<td>&gt;&#061;<\/td>\n<td>\u5927\u4e8e\u7b49\u4e8e<\/td>\n<\/tr>\n<tr>\n<td>&lt;&#061;<\/td>\n<td>\u5c0f\u4e8e\u7b49\u4e8e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>&#x1f517; Python \u7279\u8272&#xff1a;\u94fe\u5f0f\u6bd4\u8f83<\/h3>\n<p>\u8fd9\u662f Python \u975e\u5e38\u4f18\u96c5\u7684\u7279\u6027\u2014\u2014\u4f60\u53ef\u4ee5\u628a\u591a\u4e2a\u6bd4\u8f83\u8fde\u8d77\u6765\u5199&#xff0c;\u5c31\u50cf\u6570\u5b66\u91cc\u7684 a &lt; b &lt; c\u3002<\/p>\n<p>x <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">5<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">1<\/span> <span class=\"token operator\">&lt;<\/span> x <span class=\"token operator\">&lt;<\/span> <span class=\"token number\">10<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># True&#xff08;\u7b49\u4ef7\u4e8e 1 &lt; x and x &lt; 10&#xff09;<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">10<\/span> <span class=\"token operator\">&gt;<\/span> x <span class=\"token operator\">&gt;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># True<\/span><\/p>\n<p>\u751a\u81f3\u53ef\u4ee5\u6df7\u642d&#xff1a;<\/p>\n<p><span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">3<\/span> <span class=\"token operator\">&lt;<\/span> <span class=\"token number\">5<\/span> <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token number\">5<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># True&#xff08;\u5148\u6bd4\u8f83 3&lt;5 \u5f97 True&#xff0c;\u518d\u6bd4\u8f83 5&#061;&#061;5 \u5f97 True&#xff0c;\u7136\u540e True and True&#xff1f;\u4e0d&#xff0c;\u5176\u5b9e\u662f\u94fe\u5f0f&#xff0c;\u76f8\u5f53\u4e8e 3&lt;5 and 5&#061;&#061;5&#xff09;<\/span><\/p>\n<p>\u94fe\u5f0f\u6bd4\u8f83\u662f\u9010\u4e2a\u6bd4\u8f83&#xff0c;\u4e2d\u95f4\u7528 and \u8fde\u63a5&#xff0c;\u4f46\u6bd4\u76f4\u63a5\u5199 and \u66f4\u7b80\u6d01\u3002<\/p>\n<hr \/>\n<h2>\u4e09\u3001\u903b\u8f91\u8fd0\u7b97\u7b26&#xff1a;\u4e0e\u6216\u975e<\/h2>\n<p>\u903b\u8f91\u8fd0\u7b97\u7b26\u7528\u4e8e\u7ec4\u5408\u5e03\u5c14\u503c&#xff0c;\u540c\u6837\u8fd4\u56de\u5e03\u5c14\u503c\u3002<\/p>\n<table>\n<tr>\u8fd0\u7b97\u7b26\u542b\u4e49\u793a\u4f8b\u7ed3\u679c<\/tr>\n<tbody>\n<tr>\n<td>and<\/td>\n<td>\u4e0e&#xff08;\u4e24\u8005\u4e3a\u771f\u624d\u771f&#xff09;<\/td>\n<td>True and False<\/td>\n<td>False<\/td>\n<\/tr>\n<tr>\n<td>or<\/td>\n<td>\u6216&#xff08;\u4e00\u4e2a\u4e3a\u771f\u5c31\u771f&#xff09;<\/td>\n<td>True or False<\/td>\n<td>True<\/td>\n<\/tr>\n<tr>\n<td>not<\/td>\n<td>\u975e&#xff08;\u53d6\u53cd&#xff09;<\/td>\n<td>not True<\/td>\n<td>False<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>\u26a1 \u77ed\u8def\u6c42\u503c&#xff08;Short-circuit Evaluation&#xff09;<\/h3>\n<p>Python \u7684\u903b\u8f91\u8fd0\u7b97\u7b26\u6709\u201c\u5077\u61d2\u201d\u884c\u4e3a&#xff1a;<\/p>\n<ul>\n<li>and&#xff1a;\u5982\u679c\u5de6\u8fb9\u4e3a False&#xff0c;\u53f3\u8fb9\u6839\u672c\u4e0d\u4f1a\u6267\u884c&#xff08;\u56e0\u4e3a\u7ed3\u679c\u5df2\u7ecf\u786e\u5b9a\u662f False&#xff09;<\/li>\n<li>or&#xff1a;\u5982\u679c\u5de6\u8fb9\u4e3a True&#xff0c;\u53f3\u8fb9\u4e0d\u4f1a\u6267\u884c<\/li>\n<\/ul>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">risky<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u6267\u884c\u4e86 risky \u51fd\u6570&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token boolean\">True<\/span><\/p>\n<p><span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token boolean\">False<\/span> <span class=\"token keyword\">and<\/span> risky<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span>  <span class=\"token comment\"># \u4e0d\u4f1a\u8f93\u51fa\u4efb\u4f55\u4e1c\u897f&#xff0c;risky \u6ca1\u6267\u884c<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token boolean\">True<\/span> <span class=\"token keyword\">or<\/span> risky<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span>    <span class=\"token comment\"># \u4e5f\u4e0d\u4f1a\u6267\u884c risky<\/span><\/p>\n<p>\u8fd9\u4e2a\u7279\u6027\u53ef\u4ee5\u7528\u6765\u5199\u7b80\u6d01\u7684\u6761\u4ef6\u5224\u65ad&#xff0c;\u6bd4\u5982&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u5982\u679c\u5217\u8868\u4e0d\u4e3a\u7a7a&#xff0c;\u624d\u8bbf\u95ee\u7b2c\u4e00\u4e2a\u5143\u7d20<\/span><br \/>\n<span class=\"token keyword\">if<\/span> lst <span class=\"token keyword\">and<\/span> lst<span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u7b2c\u4e00\u4e2a\u5143\u7d20\u662f1&#034;<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<hr \/>\n<h3>&#x1f9e0; \u51b7\u77e5\u8bc6&#xff1a;\u903b\u8f91\u8fd0\u7b97\u7b26\u8fd4\u56de\u7684\u4e0d\u4e00\u5b9a\u662f\u5e03\u5c14\u503c<\/h3>\n<p>and \u548c or \u8fd4\u56de\u7684\u662f\u5b9e\u9645\u53c2\u4e0e\u8ba1\u7b97\u7684\u503c&#xff0c;\u800c\u4e0d\u662f\u5355\u7eaf\u7684 True\/False\u3002<\/p>\n<ul>\n<li>x and y&#xff1a;\u5982\u679c x \u4e3a\u5047&#xff0c;\u8fd4\u56de x&#xff1b;\u5426\u5219\u8fd4\u56de y\u3002<\/li>\n<li>x or y&#xff1a;\u5982\u679c x \u4e3a\u771f&#xff0c;\u8fd4\u56de x&#xff1b;\u5426\u5219\u8fd4\u56de y\u3002<\/li>\n<\/ul>\n<p><span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span> <span class=\"token keyword\">and<\/span> <span class=\"token number\">100<\/span><span class=\"token punctuation\">)<\/span>    <span class=\"token comment\"># 0&#xff08;0 \u88ab\u89c6\u4e3a\u5047&#xff0c;\u8fd4\u56de 0&#xff09;<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">3<\/span> <span class=\"token keyword\">and<\/span> <span class=\"token number\">5<\/span><span class=\"token punctuation\">)<\/span>      <span class=\"token comment\"># 5&#xff08;3 \u4e3a\u771f&#xff0c;\u8fd4\u56de 5&#xff09;<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span> <span class=\"token keyword\">or<\/span> <span class=\"token number\">100<\/span><span class=\"token punctuation\">)<\/span>     <span class=\"token comment\"># 100&#xff08;0 \u4e3a\u5047&#xff0c;\u8fd4\u56de 100&#xff09;<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">3<\/span> <span class=\"token keyword\">or<\/span> <span class=\"token number\">5<\/span><span class=\"token punctuation\">)<\/span>       <span class=\"token comment\"># 3&#xff08;3 \u4e3a\u771f&#xff0c;\u8fd4\u56de 3&#xff09;<\/span><\/p>\n<p>\u8fd9\u5728\u7ed9\u53d8\u91cf\u8d4b\u9ed8\u8ba4\u503c\u65f6\u5f88\u6709\u7528&#xff1a;<\/p>\n<p>name <span class=\"token operator\">&#061;<\/span> <span class=\"token builtin\">input<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u8f93\u5165\u540d\u5b57&#xff1a;&#034;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">or<\/span> <span class=\"token string\">&#034;\u533f\u540d\u7528\u6237&#034;<\/span>   <span class=\"token comment\"># \u5982\u679c\u8f93\u5165\u4e3a\u7a7a&#xff0c;name \u5c31\u662f &#034;\u533f\u540d\u7528\u6237&#034;<\/span><\/p>\n<hr \/>\n<h2>\u56db\u3001\u8d4b\u503c\u590d\u5408\u8fd0\u7b97\u7b26&#xff1a;\u5077\u61d2\u7684\u827a\u672f<\/h2>\n<p>\u628a\u7b97\u672f\u8fd0\u7b97\u7b26\u548c\u8d4b\u503c\u7ed3\u5408\u8d77\u6765&#xff0c;\u53ef\u4ee5\u5c11\u6572\u51e0\u4e2a\u952e\u3002<\/p>\n<table>\n<tr>\u8fd0\u7b97\u7b26\u793a\u4f8b\u7b49\u4ef7\u4e8e<\/tr>\n<tbody>\n<tr>\n<td>&#043;&#061;<\/td>\n<td>a &#043;&#061; 1<\/td>\n<td>a &#061; a &#043; 1<\/td>\n<\/tr>\n<tr>\n<td>-&#061;<\/td>\n<td>a -&#061; 1<\/td>\n<td>a &#061; a &#8211; 1<\/td>\n<\/tr>\n<tr>\n<td>*&#061;<\/td>\n<td>a *&#061; 2<\/td>\n<td>a &#061; a * 2<\/td>\n<\/tr>\n<tr>\n<td>\/&#061;<\/td>\n<td>a \/&#061; 2<\/td>\n<td>a &#061; a \/ 2<\/td>\n<\/tr>\n<tr>\n<td>\/\/&#061;<\/td>\n<td>a \/\/&#061; 2<\/td>\n<td>a &#061; a \/\/ 2<\/td>\n<\/tr>\n<tr>\n<td>%&#061;<\/td>\n<td>a %&#061; 2<\/td>\n<td>a &#061; a % 2<\/td>\n<\/tr>\n<tr>\n<td>**&#061;<\/td>\n<td>a **&#061; 2<\/td>\n<td>a &#061; a ** 2<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6ce8\u610f&#xff1a;\u8fd9\u4e9b\u8fd0\u7b97\u7b26\u4f1a\u6539\u53d8\u53d8\u91cf\u672c\u8eab&#xff08;\u539f\u5730\u4fee\u6539&#xff0c;\u4f46\u5982\u679c\u53d8\u91cf\u662f\u4e0d\u53ef\u53d8\u7c7b\u578b&#xff0c;\u5b9e\u9645\u4e0a\u4f1a\u91cd\u65b0\u7ed1\u5b9a\u65b0\u5bf9\u8c61&#xff09;\u3002<\/p>\n<hr \/>\n<h2>\u4e94\u3001\u6210\u5458\u8fd0\u7b97\u7b26&#xff1a;\u5728\u4e0d\u5728&#xff1f;<\/h2>\n<p>\u68c0\u67e5\u4e00\u4e2a\u503c\u662f\u5426\u5b58\u5728\u4e8e\u4e00\u4e2a\u5e8f\u5217&#xff08;\u5b57\u7b26\u4e32\u3001\u5217\u8868\u3001\u5143\u7ec4\u3001\u5b57\u5178\u7b49&#xff09;\u4e2d\u3002<\/p>\n<table>\n<tr>\u8fd0\u7b97\u7b26\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>in<\/td>\n<td>\u5b58\u5728<\/td>\n<\/tr>\n<tr>\n<td>not in<\/td>\n<td>\u4e0d\u5b58\u5728<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;a&#034;<\/span> <span class=\"token keyword\">in<\/span> <span class=\"token string\">&#034;hello&#034;<\/span><span class=\"token punctuation\">)<\/span>        <span class=\"token comment\"># False<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">3<\/span> <span class=\"token keyword\">in<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">3<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span>        <span class=\"token comment\"># True<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;name&#034;<\/span> <span class=\"token keyword\">in<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token string\">&#034;name&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#034;Alice&#034;<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span>  <span class=\"token comment\"># True&#xff08;\u5b57\u5178\u5224\u65ad\u952e\u662f\u5426\u5b58\u5728&#xff09;<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">4<\/span> <span class=\"token keyword\">not<\/span> <span class=\"token keyword\">in<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">3<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span>    <span class=\"token comment\"># True<\/span><\/p>\n<hr \/>\n<h3>&#x1f4a1; \u5b9e\u7528\u6280\u5de7&#xff1a;\u7528 in \u7b80\u5316\u590d\u6742\u6761\u4ef6<\/h3>\n<p>\u4ee3\u66ff\u957f\u957f\u7684 if x &#061;&#061; 1 or x &#061;&#061; 2 or x &#061;&#061; 3&#xff1a;<\/p>\n<p><span class=\"token keyword\">if<\/span> x <span class=\"token keyword\">in<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">3<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;x \u662f 1\u30012 \u6216 3&#034;<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<hr \/>\n<h2>\u516d\u3001\u8eab\u4efd\u8fd0\u7b97\u7b26&#xff1a;\u662f\u4e0d\u662f\u540c\u4e00\u4e2a\u201c\u4eba\u201d&#xff1f;<\/h2>\n<p>\u8eab\u4efd\u8fd0\u7b97\u7b26\u6bd4\u8f83\u7684\u662f\u4e24\u4e2a\u53d8\u91cf\u662f\u5426\u5f15\u7528\u540c\u4e00\u4e2a\u5bf9\u8c61&#xff08;\u5185\u5b58\u5730\u5740\u76f8\u540c&#xff09;\u3002<\/p>\n<table>\n<tr>\u8fd0\u7b97\u7b26\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>is<\/td>\n<td>\u662f\u540c\u4e00\u4e2a\u5bf9\u8c61<\/td>\n<\/tr>\n<tr>\n<td>is not<\/td>\n<td>\u4e0d\u662f\u540c\u4e00\u4e2a\u5bf9\u8c61<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>&#x1f19a; is \u4e0e &#061;&#061; \u7684\u533a\u522b<\/h3>\n<ul>\n<li>&#061;&#061; \u6bd4\u8f83\u7684\u662f\u503c\u662f\u5426\u76f8\u7b49<\/li>\n<li>is \u6bd4\u8f83\u7684\u662f\u8eab\u4efd&#xff08;\u5185\u5b58\u5730\u5740&#xff09;\u662f\u5426\u76f8\u540c<\/li>\n<\/ul>\n<p>a <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">3<\/span><span class=\"token punctuation\">]<\/span><br \/>\nb <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">3<\/span><span class=\"token punctuation\">]<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span>a <span class=\"token operator\">&#061;&#061;<\/span> b<span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># True&#xff08;\u503c\u4e00\u6837&#xff09;<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span>a <span class=\"token keyword\">is<\/span> b<span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># False&#xff08;\u4e0d\u540c\u5bf9\u8c61&#xff09;<\/span><\/p>\n<p>c <span class=\"token operator\">&#061;<\/span> a<br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span>c <span class=\"token keyword\">is<\/span> a<span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># True&#xff08;c \u548c a \u6307\u5411\u540c\u4e00\u4e2a\u5217\u8868&#xff09;<\/span><\/p>\n<hr \/>\n<h3>\u26a0\ufe0f \u4f7f\u7528\u5efa\u8bae<\/h3>\n<ul>\n<li>\u6bd4\u8f83 None \u65f6&#xff0c;\u5fc5\u987b\u7528 is&#xff08;\u8fd9\u662f PEP 8 \u98ce\u683c\u6307\u5357\u7684\u5efa\u8bae&#xff09;<\/li>\n<li>\u6bd4\u8f83\u5e03\u5c14\u503c\u65f6\u4e5f\u7528 is&#xff08;if x is True&#xff09;&#xff0c;\u4f46\u901a\u5e38\u76f4\u63a5\u7528 if x \u5373\u53ef<\/li>\n<\/ul>\n<p>result <span class=\"token operator\">&#061;<\/span> <span class=\"token boolean\">None<\/span><br \/>\n<span class=\"token keyword\">if<\/span> result <span class=\"token keyword\">is<\/span> <span class=\"token boolean\">None<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u6ca1\u7ed3\u679c&#034;<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<hr \/>\n<h3>&#x1fa84; \u51b7\u77e5\u8bc6&#xff1a;\u5c0f\u6574\u6570\u7f13\u5b58<\/h3>\n<p>Python \u4e3a\u4e86\u4f18\u5316&#xff0c;\u4f1a\u7f13\u5b58\u5c0f\u6574\u6570\u5bf9\u8c61&#xff08;\u901a\u5e38\u662f -5 \u5230 256&#xff09;\u3002\u6240\u4ee5\u6709\u65f6\u5019\u4e24\u4e2a\u4e0d\u540c\u7684\u53d8\u91cf&#xff0c;\u53ea\u8981\u503c\u5728\u8fd9\u4e2a\u8303\u56f4\u5185&#xff0c;is \u6bd4\u8f83\u4e5f\u4f1a\u662f True\u3002<\/p>\n<p>a <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">256<\/span><br \/>\nb <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">256<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span>a <span class=\"token keyword\">is<\/span> b<span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># True&#xff08;\u88ab\u7f13\u5b58\u4e86&#xff09;<\/span><\/p>\n<p>c <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">257<\/span><br \/>\nd <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">257<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span>c <span class=\"token keyword\">is<\/span> d<span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># False&#xff08;\u8d85\u51fa\u7f13\u5b58\u8303\u56f4&#xff09;<\/span><\/p>\n<p>\u4f46\u6c38\u8fdc\u4e0d\u8981\u4f9d\u8d56\u8fd9\u4e2a\u7279\u6027&#xff0c;\u7528 is \u6bd4\u8f83\u6574\u6570\u662f\u4e2a\u574f\u4e60\u60ef&#xff0c;\u5e94\u8be5\u7528 &#061;&#061;\u3002<\/p>\n<hr \/>\n<h2>\u4e03\u3001\u4f4d\u8fd0\u7b97\u7b26&#xff08;\u9009\u8bfb&#xff09;<\/h2>\n<p>\u5982\u679c\u4f60\u4e0d\u662f\u505a\u5e95\u5c42\u5f00\u53d1\u3001\u7f51\u7edc\u534f\u8bae\u6216\u6027\u80fd\u4f18\u5316&#xff0c;\u4f4d\u8fd0\u7b97\u7b26\u53ef\u80fd\u5f88\u5c11\u7528\u5230\u3002\u4f46\u4e86\u89e3\u4e00\u4e0b\u4e5f\u6ca1\u574f\u5904\u3002<\/p>\n<table>\n<tr>\u8fd0\u7b97\u7b26\u542b\u4e49\u793a\u4f8b<\/tr>\n<tbody>\n<tr>\n<td>&amp;<\/td>\n<td>\u6309\u4f4d\u4e0e<\/td>\n<td>5 &amp; 3 \u2192 1&#xff08;0101 &amp; 0011 &#061; 0001&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>&#096;<\/td>\n<td>&#096;<\/td>\n<td>\u6309\u4f4d\u6216<\/td>\n<\/tr>\n<tr>\n<td>^<\/td>\n<td>\u6309\u4f4d\u5f02\u6216<\/td>\n<td>5 ^ 3 \u2192 6&#xff08;0101 ^ 0011 &#061; 0110&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>~<\/td>\n<td>\u6309\u4f4d\u53d6\u53cd<\/td>\n<td>~5 \u2192 -6&#xff08;\u53d6\u51b3\u4e8e\u8865\u7801\u8868\u793a&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>&lt;&lt;<\/td>\n<td>\u5de6\u79fb<\/td>\n<td>5 &lt;&lt; 1 \u2192 10&#xff08;\u76f8\u5f53\u4e8e\u4e58\u4ee52&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>&gt;&gt;<\/td>\n<td>\u53f3\u79fb<\/td>\n<td>5 &gt;&gt; 1 \u2192 2&#xff08;\u76f8\u5f53\u4e8e\u9664\u4ee52\u53d6\u6574&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5b83\u4eec\u4f5c\u7528\u4e8e\u6574\u6570\u7684\u4e8c\u8fdb\u5236\u4f4d\u3002\u65e5\u5e38\u5f00\u53d1\u4e2d\u5f88\u5c11\u76f4\u63a5\u7528&#xff0c;\u4f46\u9762\u8bd5\u53ef\u80fd\u4f1a\u8003\u3002<\/p>\n<hr \/>\n<h2>\u516b\u3001\u8fd0\u7b97\u7b26\u4f18\u5148\u7ea7&#xff1a;\u5148\u7b97\u8c01\u540e\u7b97\u8c01&#xff1f;<\/h2>\n<p>\u8fd8\u8bb0\u5f97\u5c0f\u5b66\u7684\u201c\u5148\u4e58\u9664\u540e\u52a0\u51cf\u201d\u5417&#xff1f;Python \u4e5f\u6709\u81ea\u5df1\u7684\u4f18\u5148\u7ea7\u89c4\u5219\u3002\u5982\u679c\u4e0d\u60f3\u8bb0&#xff0c;\u7528\u62ec\u53f7\u5f3a\u5236\u6307\u5b9a\u987a\u5e8f\u662f\u6700\u4fdd\u9669\u7684\u3002<\/p>\n<h3>&#x1f4ca; \u5e38\u89c1\u8fd0\u7b97\u7b26\u4f18\u5148\u7ea7&#xff08;\u4ece\u9ad8\u5230\u4f4e&#xff09;<\/h3>\n<table>\n<tr>\u4f18\u5148\u7ea7\u8fd0\u7b97\u7b26<\/tr>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>**&#xff08;\u5e42\u8fd0\u7b97&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>&#043;x, -x, ~x&#xff08;\u6b63\u8d1f\u53f7\u3001\u6309\u4f4d\u53d6\u53cd&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>*, \/, \/\/, %&#xff08;\u4e58\u9664\u53d6\u4f59&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>&#043;, -&#xff08;\u52a0\u51cf&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>&lt;&lt;, &gt;&gt;&#xff08;\u79fb\u4f4d&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>&amp;&#xff08;\u6309\u4f4d\u4e0e&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>^&#xff08;\u6309\u4f4d\u5f02\u6216&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>8<\/td>\n<td>&#096;<\/td>\n<\/tr>\n<tr>\n<td>9<\/td>\n<td>&#061;&#061;, !&#061;, &gt;, &lt;, &gt;&#061;, &lt;&#061;, in, is&#xff08;\u6bd4\u8f83\u3001\u6210\u5458\u3001\u8eab\u4efd&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>10<\/td>\n<td>not&#xff08;\u903b\u8f91\u975e&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>11<\/td>\n<td>and&#xff08;\u903b\u8f91\u4e0e&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>12<\/td>\n<td>or&#xff08;\u903b\u8f91\u6216&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>&#x1f635; \u5bb9\u6613\u51fa\u9519\u7684\u4f8b\u5b50<\/h3>\n<p><span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">2<\/span> <span class=\"token operator\">&#043;<\/span> <span class=\"token number\">3<\/span> <span class=\"token operator\">*<\/span> <span class=\"token number\">4<\/span><span class=\"token punctuation\">)<\/span>        <span class=\"token comment\"># 14&#xff0c;\u4e0d\u662f 20<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">2<\/span> <span class=\"token operator\">**<\/span> <span class=\"token number\">3<\/span> <span class=\"token operator\">**<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span>      <span class=\"token comment\"># 512&#xff0c;\u56e0\u4e3a\u5e42\u8fd0\u7b97\u662f\u53f3\u7ed3\u5408&#xff08;2**(3**2)&#061;2**9&#061;512&#xff09;<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">not<\/span> <span class=\"token boolean\">True<\/span> <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token boolean\">False<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token comment\"># True&#xff1f;False&#xff1f;\u5b9e\u9645\u4e0a not True &#061;&#061; False \u7b49\u4ef7\u4e8e not (True &#061;&#061; False) \u2192 not False \u2192 True<\/span><\/p>\n<p>\u6700\u4f73\u5b9e\u8df5&#xff1a;\u5f53\u8868\u8fbe\u5f0f\u590d\u6742\u65f6&#xff0c;\u4e3b\u52a8\u52a0\u62ec\u53f7&#xff1a;<\/p>\n<p><span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">2<\/span> <span class=\"token operator\">&#043;<\/span> <span class=\"token number\">3<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">*<\/span> <span class=\"token number\">4<\/span><span class=\"token punctuation\">)<\/span>       <span class=\"token comment\"># 20<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">not<\/span> <span class=\"token boolean\">True<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token boolean\">False<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token comment\"># False&#xff08;not True \u662f False&#xff0c;False &#061;&#061; False \u662f True&#xff1f;\u7b49\u7b49&#xff0c;\u6211\u5199\u9519\u4e86\u2014\u2014\u5e94\u8be5\u662f (not True) &#061;&#061; False \u7ed3\u679c\u662f True&#xff1f;\u8ba9\u6211\u4eec\u4e00\u6b65\u6b65&#xff1a;not True \u662f False&#xff0c;False &#061;&#061; False \u662f True\u3002\u4f46\u5982\u679c\u4e0d\u52a0\u62ec\u53f7&#xff0c;not True &#061;&#061; False \u76f8\u5f53\u4e8e not (True &#061;&#061; False) \u2192 not False \u2192 True\u3002\u4e24\u4e2a\u7ed3\u679c\u4e00\u6837&#xff1f;\u8fd9\u91cc\u53ea\u662f\u4e3e\u4f8b&#xff0c;\u603b\u4e4b\u62ec\u53f7\u80fd\u8ba9\u4f60\u610f\u56fe\u660e\u786e&#xff09;<\/span><\/p>\n<hr \/>\n<h2>\u2705 \u672c\u7ae0\u603b\u7ed3<\/h2>\n<table>\n<tr>\u7c7b\u522b\u8fd0\u7b97\u7b26\u8981\u70b9<\/tr>\n<tbody>\n<tr>\n<td>\u7b97\u672f<\/td>\n<td>&#043; &#8211; * \/ \/\/ % **<\/td>\n<td>\/ \u8fd4\u56de\u6d6e\u70b9&#xff0c;\/\/ \u6574\u9664&#xff0c;% \u53d6\u4f59&#xff0c;** \u5e42<\/td>\n<\/tr>\n<tr>\n<td>\u6bd4\u8f83<\/td>\n<td>&#061;&#061; !&#061; &gt; &lt; &gt;&#061; &lt;&#061;<\/td>\n<td>\u53ef\u94fe\u5f0f\u6bd4\u8f83 1 &lt; x &lt; 5<\/td>\n<\/tr>\n<tr>\n<td>\u903b\u8f91<\/td>\n<td>and or not<\/td>\n<td>\u77ed\u8def\u6c42\u503c&#xff0c;\u8fd4\u56de\u5b9e\u9645\u503c<\/td>\n<\/tr>\n<tr>\n<td>\u8d4b\u503c\u590d\u5408<\/td>\n<td>&#043;&#061; -&#061; *&#061; \/&#061; \/\/&#061; %&#061; **&#061;<\/td>\n<td>\u7b80\u5316\u4ee3\u7801<\/td>\n<\/tr>\n<tr>\n<td>\u6210\u5458<\/td>\n<td>in not in<\/td>\n<td>\u68c0\u67e5\u5b58\u5728\u6027<\/td>\n<\/tr>\n<tr>\n<td>\u8eab\u4efd<\/td>\n<td>is is not<\/td>\n<td>\u6bd4\u8f83\u5bf9\u8c61\u5730\u5740&#xff0c;None \u7528 is<\/td>\n<\/tr>\n<tr>\n<td>\u4f4d<\/td>\n<td>&#096;&amp;<\/td>\n<td>^ ~ &lt;&lt; &gt;&gt;&#096;<\/td>\n<\/tr>\n<tr>\n<td>\u4f18\u5148\u7ea7<\/td>\n<td>\u7528\u62ec\u53f7\u660e\u786e\u987a\u5e8f<\/td>\n<td>\u907f\u514d\u6b67\u4e49<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8bb0\u4f4f&#xff1a;\u8fd0\u7b97\u7b26\u662f\u7a0b\u5e8f\u7684\u52a8\u8bcd&#xff0c;\u638c\u63e1\u4e86\u5b83\u4eec&#xff0c;\u4f60\u5c31\u80fd\u8ba9\u6570\u636e\u52a8\u8d77\u6765\u3002<\/p>\n<hr \/>\n<h3>&#x1f680; \u4e0b\u96c6\u9884\u544a<\/h3>\n<p>\u5b66\u4f1a\u4e86\u5404\u79cd\u8fd0\u7b97&#xff0c;\u4e0b\u4e00\u6b65\u5c31\u662f\u8ba9\u7a0b\u5e8f\u6839\u636e\u6761\u4ef6\u505a\u51fa\u9009\u62e9&#xff0c;\u6216\u8005\u91cd\u590d\u6267\u884c\u67d0\u4e9b\u64cd\u4f5c\u2014\u2014\u8fd9\u5c31\u662f\u6d41\u7a0b\u63a7\u5236\u3002<\/p>\n<p>\u4e0b\u4e00\u7ae0\u6211\u4eec\u5c06\u5b66\u4e60&#xff1a;<\/p>\n<ul>\n<li>if\u3001elif\u3001else \u5224\u65ad<\/li>\n<li>while \u548c for \u5faa\u73af<\/li>\n<li>break\u3001continue\u3001else \u5faa\u73af\u4f34\u4fa3<\/li>\n<li>Python 3.10&#043; \u7684\u65b0\u73a9\u5177&#xff1a;match \u8bed\u53e5<\/li>\n<\/ul>\n<p>\u656c\u8bf7\u671f\u5f85&#xff01;&#x1f525;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#x1f4cc; \u5f15\u8a00&#xff1a;\u7f16\u7a0b\u5c31\u662f\u201c\u7b97\u8d26\u201d<br \/>\n\u4f60\u5199\u4ee3\u7801\u662f\u4e3a\u4e86\u4ec0\u4e48&#xff1f;\u5f52\u6839\u7ed3\u5e95&#xff0c;\u662f\u4e3a\u4e86\u5904\u7406\u6570\u636e\u2014\u2014\u628a\u4e00\u5806\u6570\u5b57\u3001\u5b57\u7b26\u4e32\u3001\u5e03\u5c14\u503c\u7ecf\u8fc7\u5404\u79cd\u8fd0\u7b97&#xff0c;\u53d8\u6210\u4f60\u60f3\u8981\u7684\u7ed3\u679c\u3002\u800c\u201c\u8fd0\u7b97\u201d\u9760\u7684\u5c31\u662f\u8fd0\u7b97\u7b26\u3002<br \/>\n\u60f3\u8c61\u4e00\u4e0b\u53bb\u8d85\u5e02\u8d2d\u7269&#xff1a;<br \/>\n\u4e70\u4e86 3 \u4e2a\u82f9\u679c&#xff0c;\u6bcf\u4e2a 5 \u5143 \u2192 3 * 5&#xff08;\u7b97\u672f&#xff09;\u6ee1 100 \u51cf 20 \u2192 \u603b\u4ef7\u662f\u5426 \u2265100&#xff1f;&#xff08;\u6bd4\u8f83&#xff09;\u4f1a\u5458\u518d\u6253 9 \u6298 <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[81,190],"topic":[],"class_list":["post-77356","post","type-post","status-publish","format-standard","hentry","category-server","tag-python","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u7b2c\u4e09\u7ae0\uff5c\u8fd0\u7b97\u7b26\u4e0e\u8868\u8fbe\u5f0f\uff1a\u8ba9 Python \u5e2e\u4f60\u7b97\u8d26 - \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\/77356.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u7b2c\u4e09\u7ae0\uff5c\u8fd0\u7b97\u7b26\u4e0e\u8868\u8fbe\u5f0f\uff1a\u8ba9 Python \u5e2e\u4f60\u7b97\u8d26 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"&#x1f4cc; \u5f15\u8a00&#xff1a;\u7f16\u7a0b\u5c31\u662f\u201c\u7b97\u8d26\u201d \u4f60\u5199\u4ee3\u7801\u662f\u4e3a\u4e86\u4ec0\u4e48&#xff1f;\u5f52\u6839\u7ed3\u5e95&#xff0c;\u662f\u4e3a\u4e86\u5904\u7406\u6570\u636e\u2014\u2014\u628a\u4e00\u5806\u6570\u5b57\u3001\u5b57\u7b26\u4e32\u3001\u5e03\u5c14\u503c\u7ecf\u8fc7\u5404\u79cd\u8fd0\u7b97&#xff0c;\u53d8\u6210\u4f60\u60f3\u8981\u7684\u7ed3\u679c\u3002\u800c\u201c\u8fd0\u7b97\u201d\u9760\u7684\u5c31\u662f\u8fd0\u7b97\u7b26\u3002 \u60f3\u8c61\u4e00\u4e0b\u53bb\u8d85\u5e02\u8d2d\u7269&#xff1a; \u4e70\u4e86 3 \u4e2a\u82f9\u679c&#xff0c;\u6bcf\u4e2a 5 \u5143 \u2192 3 * 5&#xff08;\u7b97\u672f&#xff09;\u6ee1 100 \u51cf 20 \u2192 \u603b\u4ef7\u662f\u5426 \u2265100&#xff1f;&#xff08;\u6bd4\u8f83&#xff09;\u4f1a\u5458\u518d\u6253 9 \u6298\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/77356.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-24T06:17:40+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/77356.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/77356.html\",\"name\":\"\u7b2c\u4e09\u7ae0\uff5c\u8fd0\u7b97\u7b26\u4e0e\u8868\u8fbe\u5f0f\uff1a\u8ba9 Python \u5e2e\u4f60\u7b97\u8d26 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-24T06:17:40+00:00\",\"dateModified\":\"2026-02-24T06:17:40+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/77356.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/77356.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/77356.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u7b2c\u4e09\u7ae0\uff5c\u8fd0\u7b97\u7b26\u4e0e\u8868\u8fbe\u5f0f\uff1a\u8ba9 Python \u5e2e\u4f60\u7b97\u8d26\"}]},{\"@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":"\u7b2c\u4e09\u7ae0\uff5c\u8fd0\u7b97\u7b26\u4e0e\u8868\u8fbe\u5f0f\uff1a\u8ba9 Python \u5e2e\u4f60\u7b97\u8d26 - \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\/77356.html","og_locale":"zh_CN","og_type":"article","og_title":"\u7b2c\u4e09\u7ae0\uff5c\u8fd0\u7b97\u7b26\u4e0e\u8868\u8fbe\u5f0f\uff1a\u8ba9 Python \u5e2e\u4f60\u7b97\u8d26 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"&#x1f4cc; \u5f15\u8a00&#xff1a;\u7f16\u7a0b\u5c31\u662f\u201c\u7b97\u8d26\u201d \u4f60\u5199\u4ee3\u7801\u662f\u4e3a\u4e86\u4ec0\u4e48&#xff1f;\u5f52\u6839\u7ed3\u5e95&#xff0c;\u662f\u4e3a\u4e86\u5904\u7406\u6570\u636e\u2014\u2014\u628a\u4e00\u5806\u6570\u5b57\u3001\u5b57\u7b26\u4e32\u3001\u5e03\u5c14\u503c\u7ecf\u8fc7\u5404\u79cd\u8fd0\u7b97&#xff0c;\u53d8\u6210\u4f60\u60f3\u8981\u7684\u7ed3\u679c\u3002\u800c\u201c\u8fd0\u7b97\u201d\u9760\u7684\u5c31\u662f\u8fd0\u7b97\u7b26\u3002 \u60f3\u8c61\u4e00\u4e0b\u53bb\u8d85\u5e02\u8d2d\u7269&#xff1a; \u4e70\u4e86 3 \u4e2a\u82f9\u679c&#xff0c;\u6bcf\u4e2a 5 \u5143 \u2192 3 * 5&#xff08;\u7b97\u672f&#xff09;\u6ee1 100 \u51cf 20 \u2192 \u603b\u4ef7\u662f\u5426 \u2265100&#xff1f;&#xff08;\u6bd4\u8f83&#xff09;\u4f1a\u5458\u518d\u6253 9 \u6298","og_url":"https:\/\/www.wsisp.com\/helps\/77356.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-24T06:17:40+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/77356.html","url":"https:\/\/www.wsisp.com\/helps\/77356.html","name":"\u7b2c\u4e09\u7ae0\uff5c\u8fd0\u7b97\u7b26\u4e0e\u8868\u8fbe\u5f0f\uff1a\u8ba9 Python \u5e2e\u4f60\u7b97\u8d26 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-24T06:17:40+00:00","dateModified":"2026-02-24T06:17:40+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/77356.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/77356.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/77356.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u7b2c\u4e09\u7ae0\uff5c\u8fd0\u7b97\u7b26\u4e0e\u8868\u8fbe\u5f0f\uff1a\u8ba9 Python \u5e2e\u4f60\u7b97\u8d26"}]},{"@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\/77356","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=77356"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/77356\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=77356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=77356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=77356"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=77356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}