{"id":6354,"date":"2021-03-25T19:43:10","date_gmt":"2021-03-25T11:43:10","guid":{"rendered":"https:\/\/vip.fxxkpython.com\/?p=6354"},"modified":"2021-03-25T19:43:14","modified_gmt":"2021-03-25T11:43:14","slug":"%e5%a6%82%e4%bd%95%e6%8a%8a-python-%e4%bb%a3%e7%a0%81%e5%86%99%e5%be%97%e4%bc%98%e9%9b%85%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/vip.fxxkpython.com\/?p=6354","title":{"rendered":"\u5982\u4f55\u628a Python \u4ee3\u7801\u5199\u5f97\u4f18\u96c5\uff1f"},"content":{"rendered":"\n<p>\u200b\u540c\u6837\u7684\u529f\u80fd\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e0d\u540c\u7684\u4ee3\u7801\u65b9\u5f0f\u6765\u5b9e\u73b0\uff0c\u5b83\u4eec\uff0c\u90fd\u53ef\u4ee5\u8dd1\u7684\u8d77\u6765\uff0c\u800c\u5728\u80cc\u540e\u7684\u90a3\u4e9b\u300c\u8df3\u52a8\u300d\u7740\u7684\u4ee3\u7801\uff0c\u6709\u7684\u7f8e\u5982\u8bd7\uff0c\u6709\u7684\u4e11\u5982\u5c4e&#8230;\u5982\u679c\u8bf4\uff0c\u4ee3\u7801\u662f\u6709\u751f\u547d\u7684\uff0c\u90a3\u4e48\u4f60\u5e0c\u671b\u5b83\u662f\u6e29\u67d4\u7684\u5929\u4ed9\uff0c\u8fd8\u662f\u62a0\u811a\u7684\u5927\u6c49\uff1f<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic1.zhimg.com\/80\/v2-3018fedb40853d6038249957bf6b6ccb_1440w.gif\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u4f60\u5728 Python \u73af\u5883\u4e2d\uff0c import \u4e00\u4e0b this\uff0c\u6d6e\u73b0\u51fa\u6765\u7684\u662f\u4e00\u9996\u8bd7\uff0c\u524d\u90e8\u5206\u662f\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>Beautiful is better than ugly. <\/p><p>Explicit is better than implicit. <\/p><p>Simple is better than complex. <\/p><p>Complex is better than complicated. <\/p><p>Flat is better than nested. Sparse is better than dense. <\/p><p>Readability counts.<\/p><\/blockquote>\n\n\n\n<p>\u4f60\u770b\u8fd9 Python \u7684\u601d\u60f3\uff0c\u8981\u7684\u5c31\u662f<strong>\u7b80\u6d01\uff0c\u6f02\u4eae\uff0c\u53ef\u8bfb\u6027\u597d&#8230;<\/strong><\/p>\n\n\n\n<p>\u4e3a\u4e86\u8ba9\u4f60\u56e2\u961f\u4e4b\u95f4\u5408\u4f5c\u5f97\u6109\u5feb\uff0c\u4e3a\u4e86\u8ba9\u4f60\u6211\u5fc3\u60c5\u597d\u4e00\u70b9\uff0c\u4e3a\u4e86\u4f60\u7684\u5e78\u798f\uff0c\u6211\u60f3\u8fd8\u662f\u6709\u5fc5\u8981\u8ddf\u4f60\u8bf4\u8bf4\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u5982\u4f55\u907f\u514d\u628a Python \u4ee3\u7801\u5199\u5f97\u8ddf\u5c4e\u4e00\u6837\u3002\u3002\u3002<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic2.zhimg.com\/80\/v2-660da5ffceeadcbe4e4a8b9bf537a17f_1440w.gif\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u90a3\u4e48\u63a5\u4e0b\u6765\u5c31\u662f<strong>\u5b66\u4e60 Python \u7684\u6b63\u786e\u59ff\u52bf<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic4.zhimg.com\/80\/v2-b78af880ed9d71ba3a6d46d15e7500ae_1440w.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<h2>\u5173\u4e8e\u540d\u79f0<\/h2>\n\n\n\n<p>\u5728\u5199\u4ee3\u7801\u7684\u65f6\u5019\uff0c\u6211\u4eec\u6709\u5f88\u591a\u5730\u65b9\u9700\u8981\u5b9a\u4e49\u540d\u79f0\uff0c\u6bd4\u5982\u5e38\u7528\u5230\u5c31\u6709\u53d8\u91cf\u7684\u540d\u79f0\uff0c\u7c7b\u7684\u540d\u79f0\uff0c\u65b9\u6cd5\u7684\u540d\u79f0\uff0c\u53c2\u6570\u7684\u540d\u79f0\u7b49\u7b49&#8230;\u5982\u4f55\u624d\u80fd\u5199\u597d\u5b83\u4eec\u5462\uff1f<\/p>\n\n\n\n<h2>\u7c7b\u540d<\/h2>\n\n\n\n<p>\u6709\u4e00\u79cd\u547d\u540d\u6cd5\u53eb\u300c<strong>\u5927\u9a7c\u5cf0\u5f0f\u547d\u540d\u6cd5<\/strong>\u300d\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u6bcf\u4e00\u4e2a\u5355\u5b57\u7684\u9996\u5b57\u6bcd\u90fd\u91c7\u7528\u5927\u5199\u5b57\u6bcd\uff0c\u4f8b\u5982\uff1aFirstName\u3001LastName\u3001CamelCase\uff0c\u4e5f\u88ab\u79f0\u4e3a<strong>Pascal\u547d\u540d\u6cd5<\/strong>\uff08\u82f1\u8bed\uff1aPascal Case\uff09\u3002<\/p><\/blockquote>\n\n\n\n<p>\u5728 Python \u4e2d\u8d77\u7c7b\u540d\u6700\u597d\u5c31\u662f\u4f7f\u7528\u8fd9\u79cd\u65b9\u5f0f\uff0c\u6bd4\u5982\uff1aMyClass\uff0cFxxkPython\u3002<\/p>\n\n\n\n<p>\u8fd8\u6709\u4e00\u70b9\u8981\u6ce8\u610f\u7684\u662f\uff0c\u6709\u4e9b\u5355\u8bcd\u672c\u8eab\u5c31\u662f\u7f29\u5199\u7684\uff0c\u6bd4\u5982\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>HTML = HyperText Markup Language <\/p><p>HTTP = HyperText Transfer Protocol<\/p><\/blockquote>\n\n\n\n<p>\u90a3\u4e48\u5728\u5199\u542b\u6709\u8fd9\u4e9b\u5355\u8bcd\u7684\u7c7b\u540d\u65f6\uff0c\u4e5f\u662f\u9700\u8981\u5927\u5199\u7684\uff1aHTTPServerError\u800c\u4e0d\u662f\uff1aHttpServerError<\/p>\n\n\n\n<h2>\u65b9\u6cd5\u540d\u548c\u53d8\u91cf\u540d<\/h2>\n\n\n\n<p>\u65b9\u6cd5\u540d\u548c\u53d8\u91cf\u540d\u5c3d\u91cf\u5168\u4f7f\u7528\u5c0f\u5199\u5b57\u6bcd\uff0c\u5982\u679c\u540d\u79f0\u4e2d\u7684\u5355\u8bcd\u591a\uff0c\u53ef\u4ee5\u4f7f\u7528\u300c_\u300d\u6765\u5206\u5272\uff0c\u6bd4\u5982\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>first<em>name\uff0clast<\/em>name\uff0cextract_data\uff0cfile\uff0cage\uff0cname&#8230;.<\/p><\/blockquote>\n\n\n\n<h2>\u6a21\u5757\u540d\u79f0<\/h2>\n\n\n\n<p>\u6a21\u5757\u540d\u79f0\u4e5f\u662f\u5168\u4f7f\u7528\u5c0f\u5199\u5b57\u6bcd\uff0c\u4f7f\u7528\u300c_\u300d\u6765\u5206\u5272\uff0c\u6bd4\u5982\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>fxxk.py\uff0cfxxk_python.py<\/p><\/blockquote>\n\n\n\n<h2>\u5305\u540d<\/h2>\n\n\n\n<p>\u5305\u540d\u4f7f\u7528\u5c0f\u5199\u5b57\u6bcd\uff0c\u4f46\u4e0d\u5efa\u8bae\u4f7f\u7528\u300c_\u300d\u6765\u5206\u5272\uff0c\u6bd4\u5982\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>package\uff0cmypackage<\/p><\/blockquote>\n\n\n\n<h2>\u5e38\u91cf<\/h2>\n\n\n\n<p>\u5e38\u91cf\u540d\u79f0\u4f7f\u7528\u5168\u5927\u5199\u5b57\u6bcd\uff0c\u4f7f\u7528\u300c_\u300d\u6765\u5206\u5272\uff0c\u6bd4\u5982\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>MAX<em>NUM\uff0cMY<\/em>CONSTANT\uff0cCONSTANT<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic3.zhimg.com\/80\/v2-de0085136993a3ea8f3eba886c1d5563_1440w.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<h2>\u5173\u4e8e\u6ce8\u91ca<\/h2>\n\n\n\n<p>\u5728 Python \u4ee3\u7801\u4e2d\u5199\u6ce8\u91ca\u6709\u51e0\u79cd\uff0c\u6bd4\u5982\u5728\u4ee3\u7801\u5757\u6ce8\u91ca\uff0c\u5728\u884c\u5185\u6ce8\u91ca\uff0c\u5199\u6587\u6863\u7684\u6ce8\u91ca\u3002\u51e0\u4e2a\u5199\u6ce8\u91ca\u7684\u597d\u4e60\u60ef\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u4ee3\u7801\u6ce8\u91ca\u4f7f\u7528 # \u5f00\u5934\uff0c\u5e76\u5728\u540e\u9762\u7a7a\u4e00\u683c\u624d\u5f00\u59cb\u5199 <\/p><p>\u6bcf\u4e00\u884c\u4e0d\u8981\u8d85\u8fc7 72 \u4e2a\u5b57\u7b26\uff0c\u9002\u5f53\u4f7f\u7528 # \u5206\u884c <\/p><p>\u6ce8\u91ca\u8981\u548c\u4ee3\u7801\u5bf9\u9f50 <\/p><p>\u6bcf\u4e00\u6bb5\u5e94\u8be5\u7a7a\u4e00\u884c\u51fa\u6765<\/p><\/blockquote>\n\n\n\n<h2>\u884c\u5185\u6ce8\u91ca<\/h2>\n\n\n\n<p>\u6ce8\u610f\u7a7a\u683c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic4.zhimg.com\/80\/v2-f6eca59e63b467adef422b583951cc50_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2>\u4ee3\u7801\u5757\u591a\u884c\u6ce8\u91ca<\/h2>\n\n\n\n<p>\u6ce8\u610f\u5bf9\u9f50\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic1.zhimg.com\/80\/v2-aba070b596d473c4c44c54dfc0a1ca0f_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u6ce8\u610f\u6362\u884c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic2.zhimg.com\/80\/v2-5ac66d72f7fd70d0ccaa483565063eda_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2>\u6587\u6863\u5b57\u7b26\u4e32<\/h2>\n\n\n\n<p>\u9664\u4e86\u89e3\u91ca\u4ee3\u7801\u7684\u884c\u4e3a\uff0c\u6211\u4eec\u6709\u65f6\u5019\u8fd8\u9700\u8981\u5199\u4ee3\u7801\u7684\u300c\u529f\u80fd\u4f7f\u7528\u6587\u6863\u300d\uff0c\u6709\u4e86\u6587\u6863\u522b\u4eba\u624d\u80fd\u66f4\u597d\u7684\u4f7f\u7528\u4f60\u5199\u7684\u529f\u80fd\uff0c\u901a\u5e38\u6211\u4eec\u4f1a\u5728\u4ee3\u7801\u91cc\u9762\u5199 DocStrings\u3002<\/p>\n\n\n\n<p>\u5199 DocStrings \u7684\u4e60\u60ef\u65b9\u5f0f\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>Docstrings \u5e94\u8be5\u662f\u5728\u300c\u7c7b\u300d\u6216\u300c\u51fd\u6570\u5b9a\u4e49\u4e0b\u300d\u7684\u7b2c\u4e00\u884c\u5f00\u59cb\u58f0\u660e <\/p><p>Docstrings \u5e94\u8be5\u662f\u7528 &#8220;&#8221;&#8221; \u5f00\u5934\uff0c &#8220;&#8221;&#8221; \u7ed3\u5c3e <\/p><p>Docstrings \u7b2c\u4e00\u884c\u7684\u63cf\u8ff0\u5c3d\u91cf\u7b80\u77ed\u5e76\u4e14\u80fd\u8ba9\u4eba\u4e00\u4e0b\u5b50\u5c31\u77e5\u9053\u8bf4\u7684\u662f\u4ec0\u4e48 <\/p><p>\u7b2c\u4e8c\u884c\u8d77\u9700\u8981\u7a7a\u683c <\/p><p>\u6bcf\u4e00\u6bb5\u63cf\u8ff0\u4e4b\u95f4\u9700\u8981\u6709\u7a7a\u683c \u548c\u4ee3\u7801\u5bf9\u9f50 <\/p><\/blockquote>\n\n\n\n<p>\u6bcf\u4e00\u884c\u4e0d\u8981\u8d85\u8fc7 72 \u4e2a\u5b57\u7b26<\/p>\n\n\n\n<p>\u50cf\u8fd9\u6837\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic1.zhimg.com\/80\/v2-573fb13d8b5e55170f32ecf3c11afb88_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u5f53\u7136\uff0cDocStrings \u8fd8\u6709\u522b\u7684\u98ce\u683c\uff0c\u6bd4\u5982\u5e38\u89c1\u7684\u8fd8\u6709 Google \u548c Numpy \u7684\u98ce\u683c\u3002\u4f60\u53ef\u4ee5\u5728\u8fd9\u91cc\u627e\u5230\u5b83\u4eec\u7684\u4f8b\u5b50\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>https:\/\/sphinxcontrib-napoleon.readthedocs.io\/en\/latest\/example_numpy.html#example-numpy<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic2.zhimg.com\/80\/v2-fc9a6a9b21a697a1da010027898397fc_1440w.gif\" alt=\"\"\/><\/figure>\n\n\n\n<h2>\u5173\u4e8e\u4ee3\u7801<\/h2>\n\n\n\n<p>\u5176\u5b9e\u5199\u4ee3\u7801\u548c\u5199\u6587\u7ae0\u6709\u70b9\u76f8\u4f3c\uff0c\u6587\u7ae0\u8981\u8ba9\u4eba\u770b\u5f97\u4e0b\u53bb\uff0c\u8d77\u7801\u8981\u6709\u70b9\u6392\u7248\uff0c\u4ec0\u4e48\u5730\u65b9\u5e94\u8be5\u52a0\u7a7a\u683c\uff0c\u4ec0\u4e48\u5730\u65b9\u5e94\u8be5\u6362\u884c\uff0c\u5b57\u4e0e\u5b57\u4e4b\u95f4\u7684\u95f4\u8ddd\u591a\u5c11\u624d\u597d\uff1f\u884c\u4e0e\u884c\u4e4b\u95f4\u7684\u95f4\u8ddd\u591a\u5c11\u624d\u597d\uff1f\u4ec0\u4e48\u5730\u65b9\u7559\u767d\uff1f\uff08\u4f60\u770b\u6211\u516c\u4f17\u53f7\u7684\u6392\u7248\uff0c\u662f\u4e0d\u662f\u7528\u5fc3\u4e86\uff1f\uff09<\/p>\n\n\n\n<p>\u4ee3\u7801\u4e5f\u662f\u4e00\u6837\u7684\uff0c\u4e0d\u8981\u4ec0\u4e48\u90fd\u7279\u4e48\u5806\u5728\u4e00\u8d77\u3002<\/p>\n\n\n\n<h2>\u7c7b\u4e0e\u7c7b\u4e4b\u95f4\u8981\u7a7a\u4e24\u884c<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic1.zhimg.com\/80\/v2-af54b364533fb5afadcadf5078d7c5cf_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2>\u7c7b\u4e0e\u9876\u5c42\u65b9\u6cd5\u4e4b\u95f4\u4e5f\u8981\u7a7a\u4e24\u884c<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic1.zhimg.com\/80\/v2-b946e7778f8eb1061ad6c9ec178fbfb4_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2>\u7c7b\u4e2d\u7684\u65b9\u6cd5\u4e4b\u95f4\u8981\u7a7a\u4e00\u884c<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic1.zhimg.com\/80\/v2-e36f0e955524d6655aae8bd6884c96ac_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2>\u4e0d\u540c\u7684\u903b\u8f91\u4ee3\u7801\u4e4b\u95f4\u7a7a\u4e00\u884c<\/h2>\n\n\n\n<p>\u6bd4\u5982 for\uff0cif \u8fd9\u4e9b\u5177\u6709\u903b\u8f91\u6027\u7684\u8bed\u53e5\u4e4b\u95f4\uff0c\u53ef\u4ee5\u7a7a\u4e00\u884c\uff0c\u8fd9\u6837\u53ef\u4ee5\u8ba9\u903b\u8f91\u770b\u8d77\u6765\u66f4\u52a0\u6e05\u6670\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic1.zhimg.com\/80\/v2-8274ccd73df4ecb97ebda3f848535332_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2>\u4ee3\u7801\u7684\u7f29\u8fd1<\/h2>\n\n\n\n<p>\u5173\u4e8e\u4ee3\u7801\u7684\u7f29\u8fdb\u53ef\u80fd\u5927\u90e8\u5206 b \u53cb\u559c\u6b22\u7528 Tab \u952e\uff0c\u4e0d\u8fc7\u66f4\u597d\u7684\u7f29\u8fdb\u65b9\u5f0f\u662f\u300c\u8fde\u7eed 4 \u4e2a\u7a7a\u683c\u300d\u3002<\/p>\n\n\n\n<p>\u5728\u4f7f\u7528 Python2 \u90a3\u4f1a\u4f60\u8fd8\u53ef\u4ee5 Tab \u548c\u7a7a\u683c\u6df7\u5408\u4f7f\u7528\uff0c\u4e0d\u8fc7\u5728 Python3 \u4e4b\u540e\u4e0d\u53ef\u4ee5\u8fd9\u6837\uff0c\u7f29\u8fdb\u7684\u65b9\u5f0f\u8981\u4fdd\u6301\u4e00\u81f4\uff0c\u6700\u597d\u90fd\u662f\u300c\u8fde\u7eed 4 \u4e2a\u7a7a\u683c\u300d\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic1.zhimg.com\/80\/v2-58135c57a2117f49ec2e97df01cf606d_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u5982\u679c\u4f60\u5df2\u7ecf\u4e60\u60ef\u4e86 Tab \u6765\u7f29\u8fdb\uff0c\u4e5f\u6ca1\u5173\u7cfb\uff0c\u5927\u90e8\u5206\u7f16\u8f91\u5668\u90fd\u53ef\u4ee5\u81ea\u5b9a\u4e49\u6309 Tab \u7684\u65f6\u5019\uff0c\u7ed9\u4f60\u8f6c\u6362\u6210\u300c\u8fde\u7eed 4 \u4e2a\u7a7a\u683c\u300d\u3002<\/p>\n\n\n\n<h2>\u4ee3\u7801\u7684\u6362\u884c<\/h2>\n\n\n\n<p>\u5728\u5199\u4ee3\u7801\u7684\u65f6\u5019\uff0c\u8981\u8bb0\u5f97\u6362\u884c\uff0c\u6bcf\u884c\u4ee3\u7801\u6700\u597d\u4e0d\u8981\u8d85\u8fc7 79 \u4e2a\u5b57\u7b26\u3002\u5bf9\u4e8e\u4e00\u4e9b\u5b57\u5178\uff0c\u5217\u8868\uff0c\u5143\u7ec4\uff0c\u51fd\u6570\u7b49\u8fd9\u4e9b\u542b\u6709 () [] {}\uff0c\u53ef\u4ee5\u76f4\u63a5\u56de\u8f66\u6362\u884c\uff0c\u5e76\u5782\u76f4\u5bf9\u9f50\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic2.zhimg.com\/80\/v2-bee2a9df5b2f32bf154d011c444bbfeb_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u6709\u65f6\u5019\u4e3a\u4e86\u7f8e\u89c2\u5927\u65b9\uff0c\u4f60\u53ef\u4ee5\u628a\u62ec\u53f7\u7684\u7ed3\u5c3e\u53e6\u8d77\u4e00\u884c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic4.zhimg.com\/80\/v2-9ac253051ad873da03ff4a949283bf91_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u5982\u679c\u542b\u6709\u8fd0\u7b97\u7b26\uff0c\u5efa\u8bae\u6362\u884c\u7684\u65f6\u5019\u628a\u7b26\u53f7\u653e\u5728\u524d\u9762\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic4.zhimg.com\/80\/v2-908d7f6d82cb83c4ce8e6cfd2f7a136e_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u5176\u5b83\u7684\u4f60\u53ef\u4ee5\u4f7f\u7528\u53cd\u659c\u6760\u6362\u884c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic1.zhimg.com\/80\/v2-11cb361062337a75a4cb91ce167fba73_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p><strong>\u4ee3\u7801\u7684\u7a7a\u683c<\/strong>\u5728\u4ee5\u4e0b\u8fd9\u4e9b\u8fd0\u7b97\u64cd\u4f5c\u7b26\u7684\u4e24\u8fb9\uff0c\u9700\u8981\u52a0\u4e2a\u7a7a\u683c\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p><strong>\u8fd0\u7b97\uff1a<\/strong> + _ * = += -= \u7b49 <\/p><p><strong>\u6bd4\u8f83\uff1a<\/strong> ==, &lt;, >, !=, &lt;>, &lt;=, >=, in, not in, is, is not <\/p><p><strong>\u5e03\u5c14\uff1a<\/strong> and, or, not<\/p><\/blockquote>\n\n\n\n<p>\u4e0d\u8fc7\uff0c\u5982\u679c\u4ee3\u7801\u4e2d\u542b\u6709\u591a\u4e2a\u8fd0\u7b97\uff0c\u90a3\u4e48\u53ef\u4ee5\u76f4\u63a5\u5728\u6700\u4f4e\u4f18\u5148\u7ea7\u7684\u5730\u65b9\u6dfb\u52a0\u7a7a\u683c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic4.zhimg.com\/80\/v2-bbd01d96270f9fdc8fa61455b673c44f_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u5bf9\u4e8e\u51fd\u6570\u7684\u53c2\u6570\u9ed8\u8ba4\u8d4b\u503c\uff0c\u4e5f\u4e0d\u9700\u8981\u6dfb\u52a0\u7a7a\u683c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic2.zhimg.com\/80\/v2-9beaac763f8515c809c47793e41f2dd7_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u5728\u5192\u53f7\uff0c\u5206\u53f7\uff0c\u9017\u53f7\u540e\u9762\u52a0\u7a7a\u683c\uff0c\u524d\u9762\u4e0d\u8981\u52a0\u7a7a\u683c(\u5207\u7247\u4e2d\u7684\u5192\u53f7\u9664\u5916)\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic4.zhimg.com\/80\/v2-6051b7108f80d37cec4a463b0a43db81_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u7d27\u9760 ()\u3001[]\u3001{} \u4e0d\u8981\u52a0\u7a7a\u683c \uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic1.zhimg.com\/80\/v2-3019fdeddbb4fcb1e4244762c258875c_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u5728\u51fd\u6570\u8c03\u7528\u548c\u7d22\u5f15\u4f7f\u7528\u65f6\u4e0d\u8981\u52a0\u7a7a\u683c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic1.zhimg.com\/80\/v2-9872aa0c86bb4f51ae68d8fa13be40e1_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2>\u5173\u4e8e import<\/h2>\n\n\n\n<p>\u5728\u6587\u4ef6\u7684\u9876\u90e8\uff0c\u6211\u4eec\u5199 import \u7684\u8bed\u53e5\uff0c\u5177\u6709\u5982\u4e0b\u987a\u5e8f\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic2.zhimg.com\/80\/v2-962acbe91c5afd58b9389775a289a663_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u4ece\u6807\u51c6\u5185\u7f6e\u5e93\u5f00\u59cb\u5bfc\u5165\uff0c\u63a5\u7740\u662f\u7b2c\u4e09\u65b9\u5e93\uff0c\u6700\u540e\u5bfc\u5165\u7684\u662f\u81ea\u5df1\u672c\u5730\u5199\u7684\u5e93\uff0c\u5e76\u4e14\u5206\u597d\u7ec4\uff0c\u4e4b\u95f4\u7a7a\u4e00\u884c\u3002import \u8bed\u53e5\u8981\u6362\u884c\uff0c\u4e0d\u8981\u5199\u5728\u4e00\u884c\u4e0a\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic1.zhimg.com\/80\/v2-c10448a1401adb58dcca068fc5a1b919_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u4f46\u662f\u4ece\u4e00\u4e2a\u5e93\u4e2d\u5bfc\u5165\u5177\u4f53\u7684\u7c7b\uff0c\u5c31\u53ef\u4ee5\u5728\u5199\u5728\u4e00\u884c\u4e0a\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic1.zhimg.com\/80\/v2-6603d97a26afd9f02534381831abc4ae_1440w.png\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pic2.zhimg.com\/80\/v2-cb586e6083800c27ad1137d03680a13c_1440w.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>OK\uff0c\u4ee5\u4e0a\u5c31\u662f\u5c0f\u5e05b\u4eca\u5929\u7ed9\u4f60\u5e26\u6765\u7684\u5206\u4eab\uff0c\u6211\u60f3\u8fd9\u4e9b\u90fd\u662f\u4f60\u4f1a\u7ecf\u5e38\u64cd\u4f5c\u5230\u7684\u4e1c\u897f\uff0c\u5982\u679c\u4f60\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u5982\u4f55\u628a Python \u5199\u7684\u4f18\u96c5\uff0c\u53ef\u4ee5\u770b\u770b\u5b98\u7f51\u7684 PEP8 \u4ecb\u7ecd\u3002<\/p>\n\n\n\n<p>\u5f53\u7136\uff0c\u4e5f\u6709\u4e00\u4e9b\u63d2\u4ef6\u53ef\u4ee5\u4f7f\u7528\uff0c\u5b83\u4eec\u53ef\u4ee5\u683c\u5f0f\u5316\u4f60\u7684\u4ee3\u7801\uff0c\u6bd4\u5982 vim-autopep8\uff0c\u6216\u8005\u4e00\u4e9b\u5e93\u4e5f\u53ef\u4ee5\u68c0\u67e5\u4f60\u7684\u4ee3\u7801\u662f\u5426\u7b26\u5408\u89c4\u8303\uff0c\u6bd4\u5982 pylint\uff0cpycodestyle \u7b49\uff0c\u4e0d\u8fc7\u5c0f\u5e05b\u8fd8\u662f\u5efa\u8bae\u4f60\u81ea\u5df1\u5728\u5199\u4ee3\u7801\u7684\u65f6\u5019\u591a\u517b\u6210\u4ee5\u4e0a\u8fd9\u4e9b\u597d\u4e60\u60ef\uff0c\u800c\u4e0d\u662f\u9760\u63d2\u4ef6\u6765\u5e2e\u4f60\u683c\u5f0f\u5316\u90a3\u4e9b shit\u3002<\/p>\n\n\n\n<p>\u4e5f\u8bb8\u6709\u4e9b\u4eba\u5e76\u4e0d\u5728\u610f\u8fd9\u4e9b\uff0c\u89c9\u5f97\u53ef\u8bfb\u6027\u6ca1\u4ec0\u4e48\uff0c\u90a3\u5c31\u8ba9\u4ed6\u4eec\u968f\u610f\u5c31\u597d\u3002\u4e0d\u8fc7\u4f60\u90fd\u770b\u5230\u8fd9\u91cc\u4e86\uff0c\u8bf4\u660e\u4f60\u8fd8\u662f\u5bf9\u67d0\u65b9\u9762\u6709\u7ec6\u8282\u4e0a\u7684\u8ffd\u6c42\uff0c\u90a3\u4e48\u54b1\u4eec\u5c31\u4e00\u70b9\u4e00\u70b9\u6539\u8fdb\u5457\uff0c\u5bf9\u4f60\u603b\u4f1a\u6709\u597d\u5904\u7684\u3002<\/p>\n\n\n\n<p>\u4e4b\u524d\u5728\u67d0\u4e2a\u7fa4\u4e0a\uff0c\u6709\u4f4d\u4e0d\u8ba4\u8bc6\u7684\u670b\u53cb\u770b\u5230\u4e86\u6211\u7684\u4ee3\u7801\uff0c\u4ed6\u5938\u6211\u7684\u90a3\u53e5\u8bdd\u6211\u5230\u73b0\u5728\u8fd8\u8bb0\u5f97\uff1a\u300c\u4f60\u7684\u4ee3\u7801\u770b\u8d77\u6765\u597d\u8212\u670d\u554a\u300d\uff0c\u8fd9\u300c\u8212\u670d\u300d\u4e24\u4e2a\u5b57\u5c31\u50cf\u4f60\u7ed9\u6211\u70b9\u8d5e\u5206\u4eab\u90a3\u6837\u5f00\u5fc3\u3002\u3002\u3002\u6211\u4e4b\u6240\u4ee5\u5f00\u5fc3\u4e14\u8bb0\u5f97\uff0c\u662f\u56e0\u4e3a\u4ed6\u770b\u5230\u4e86\u6211\u6ce8\u91cd\u7684\u7ec6\u8282\u3002<\/p>\n\n\n\n<p>\u8bf4\u4e0d\u5b9a\u54ea\u5929\uff0c\u56e0\u4e3a\u67d0\u4e2a\u7ec6\u8282\uff0c\u4f60\u5c31\u8131\u300c\u5f15\u300d\u800c\u51fa\uff0c\u90a3\u53ef\u771f\u662f\u5e05\u554a\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u200b\u540c\u6837\u7684\u529f\u80fd\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e0d\u540c\u7684\u4ee3\u7801\u65b9\u5f0f\u6765\u5b9e\u73b0\uff0c\u5b83\u4eec\uff0c\u90fd\u53ef\u4ee5\u8dd1\u7684\u8d77\u6765\uff0c\u800c\u5728\u80cc\u540e\u7684\u90a3\u4e9b\u300c\u8df3\u52a8\u300d\u7740\u7684\u4ee3\u7801\uff0c\u6709\u7684\u7f8e\u5982\u8bd7\uff0c\u6709\u7684\u4e11\u5982\u5c4e&#8230;\u5982\u679c\u8bf4\uff0c\u4ee3\u7801\u662f\u6709\u751f\u547d\u7684\uff0c\u90a3\u4e48\u4f60\u5e0c\u671b\u5b83\u662f\u6e29\u67d4\u7684\u5929\u4ed9\uff0c\u8fd8\u662f\u62a0\u811a\u7684\u5927\u6c49\uff1f \u4f60\u5728 Python \u73af\u5883\u4e2d\uff0c import \u4e00&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[303],"tags":[554,555,557,558,556],"_links":{"self":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/6354"}],"collection":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6354"}],"version-history":[{"count":1,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/6354\/revisions"}],"predecessor-version":[{"id":6355,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/6354\/revisions\/6355"}],"wp:attachment":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6354"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6354"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6354"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}