{"id":2248,"date":"2020-09-15T22:16:58","date_gmt":"2020-09-15T14:16:58","guid":{"rendered":"http:\/\/blog.ywdevops.cn\/?p=2248"},"modified":"2023-10-30T15:08:11","modified_gmt":"2023-10-30T07:08:11","slug":"python-6","status":"publish","type":"post","link":"https:\/\/blog.ywdevops.cn\/index.php\/2020\/09\/15\/python-6\/","title":{"rendered":"python\u5f02\u5e38"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u7a0b\u5e8f\u8fd0\u884c\u65f6\uff0c\u7ecf\u5e38\u4f1a\u51fa\u73b0\u5404\u79cd\u5404\u6837\u7684\u9519\u8bef\uff0c\u8fd9\u4e9b\u9519\u8bef\u7edf\u79f0\u4e3a\u5f02\u5e38\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>python\u4e2d\u5e38\u89c1\u5f02\u5e38\uff1a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\">\u5f02\u5e38<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u63cf\u8ff0<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">NameError<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u5c1d\u8bd5\u8bbf\u95ee\u4e00\u4e2a\u6ca1\u6709\u58f0\u660e\u7684\u53d8\u91cf\u5f15\u53d1\u7684\u9519\u8bef<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">IndexError<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u7d22\u5f15\u8d85\u51fa\u5e8f\u5217\u8303\u56f4\u5f15\u53d1\u7684\u9519\u8bef<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">IndentationError<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u7f29\u8fdb\u9519\u8bef<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">ValueError<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u4f20\u5165\u7684\u503c\u9519\u8bef<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">KeyError<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u8bf7\u6c42\u4e00\u4e2a\u4e0d\u5b58\u5728\u7684\u5b57\u5178\u5173\u952e\u5b57\u5f15\u53d1\u7684\u9519\u8bef<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">IOError<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u8f93\u5165\u8f93\u51fa\u9519\u8bef(\u5982\u8bfb\u53d6\u6587\u4ef6\u4e0d\u5b58\u5728)<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">ImportError<\/td><td class=\"has-text-align-center\" data-align=\"center\">Import\u65e0\u6cd5\u627e\u5230\u6a21\u5757\u6216from\u627e\u4e0d\u5230\u540d\u79f0<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">AttributeError<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u5c1d\u8bd5\u8bbf\u95ee\u672a\u77e5\u7684\u5bf9\u8c61\u5c5e\u6027\u5f15\u53d1\u7684\u9519\u8bef<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">TypeError<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u7c7b\u578b\u4e0d\u5408\u9002\u5f15\u53d1\u7684\u9519\u8bef<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">MemoryError<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u5185\u5b58\u4e0d\u8db3<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">ZeroDivisionError<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u9664\u6570\u4e3a0\u5f15\u53d1\u7684\u9519\u8bef<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">FileNotFoundError<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u6587\u4ef6\u6ca1\u6709\u53d1\u73b0\u5f02\u5e38<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>\u4e00\u3001Python\u5f02\u5e38\u5904\u7406\u8bed\u53e5<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1\u3001try&#8230;except\u8bed\u53e5\u5904\u7406\u5f02\u5e38<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728Python\u4e2d\uff0c\u63d0\u4f9b\u4e86try..except\u8bed\u53e5\u7528\u6765\u6355\u83b7\u5e76\u5904\u7406\u5f02\u5e38\uff0c\u5728\u4f7f\u7528\u7684\u65f6\u5019\uff0c\u628a\u53ef\u80fd\u4ea7\u751f\u9519\u7684\u4ee3\u7801\u653e\u5728try\u8bed\u53e5\u4e2d\uff0c\u628a\u5904\u7406\u7ed3\u679c\u653e\u5728expect\u8bed\u53e5\u5757\u4e2d\uff0c\u8fd9\u6837\u5f53try\u8bed\u53e5\u5757\u4e2d\u51fa\u73b0\u9519\u8bef\u540e\uff0c\u5c06\u6267\u884cexpect\u8bed\u53e5\u5757\u4e2d\u7684\u4ee3\u7801\uff0c\u5982\u679ctry\u8bed\u53e5\u5757\u4e2d\u6ca1\u6709\u9519\u8bef\uff0cexpect\u5c06\u4e0d\u4f1a\u6267\u884c\uff0c\u8bed\u6cd5\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>try:\n    block1\nexpect exceptname as alias:\n    block2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u53c2\u6570\u8bf4\u660e\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>block1\uff1a\u8868\u793a\u53ef\u80fd\u51fa\u73b0\u7684\u9519\u8bef\u4ee3\u7801<\/li>\n\n\n\n<li>exceptname:\u8868\u793a\u8981\u6355\u83b7\u7684\u5f02\u5e38\u540d\u79f0\uff0cas alias\u8868\u793a\u4e3a\u5f02\u5e38\u6307\u5b9a\u522b\u540d\uff0c\u5982\u679cexcept\u540e\u9762\u4e0d\u52a0\u5f02\u5e38\u540d\u79f0\uff0c\u8868\u793a\u6355\u83b7\u6240\u6709\u5f02\u5e38\u3002<\/li>\n\n\n\n<li>block2\uff1a\u8868\u793a\u5f02\u5e38\u5904\u7406\u6a21\u5757\uff0c\u53ef\u4ee5\u8f93\u51fa\u56fa\u5b9a\u4fe1\u606f\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u522b\u540d\u8f93\u51fa\u4fe1\u606f<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f8b\u5982:\u5b9a\u4e49size.py\u6a21\u5757\uff0c\u5b9a\u4e49\u51fd\u6570hello()\uff0c\u5e76\u8bbe\u7f6e\u4e24\u4e2a\u5f62\u5f0f\u53c2\u6570\uff0c\u901a\u8fc7try\u6355\u83b7\u5f02\u5e38\u5e76\u5904\u7406\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"563\" height=\"165\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/09\/25-1.png\" alt=\"\" class=\"wp-image-2249\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/09\/25-1.png 563w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/09\/25-1-300x88.png 300w\" sizes=\"auto, (max-width: 563px) 100vw, 563px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">expect\u540e\u9762\u53ef\u4ee5\u540c\u65f6\u5904\u7406\u591a\u4e2a\u5f02\u5e38\uff0c\u5e76\u7528\u9017\u53f7\u5206\u9694\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>except (ValueError,ZeroDivisionError)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762\u4f8b\u5b50\u5b9a\u4e49\u6587\u4ef6\u672a\u53d1\u73b0\u5f02\u5e38\uff0c\u4f7f\u7528FileNotFoundError\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"693\" height=\"201\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/1-13.png\" alt=\"\" class=\"wp-image-15330\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/1-13.png 693w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/1-13-300x87.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/1-13-600x174.png 600w\" sizes=\"auto, (max-width: 693px) 100vw, 693px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"695\" height=\"71\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/2-11.png\" alt=\"\" class=\"wp-image-15331\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/2-11.png 695w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/2-11-300x31.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/2-11-600x61.png 600w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/figure>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\u610f\uff1a\u5982\u679c\u6355\u83b7\u5168\u90e8\u5f02\u5e38\uff0c\u76f4\u63a5\u4f7f\u7528except\uff0c\u540e\u9762\u4ec0\u4e48\u90fd\u4e0d\u63a5\u5373\u53ef<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2\u3001try&#8230;.except&#8230;else\u8bed\u53e5<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728Python\u4e2d\uff0c\u8fd8\u6709\u4e00\u79cd\u5f02\u5e38\u5904\u7406\u8bed\u53e5\uff0ctry&#8230;except&#8230;else\u8bed\u53e5\uff0c\u5176\u4e2delse\u8bed\u53e5\u8868\u793a\u5f53try\u8bed\u53e5\u65e0\u6cd5\u6355\u83b7\u5230\u5f02\u5e38\u7684\u65f6\u5019\u8981\u6267\u884c\u7684\u8bed\u53e5\uff0c\u5982\u679ctry\u8bed\u53e5\u53d1\u73b0\u5f02\u5e38\u7684\u65f6\u5019\uff0celse\u8bed\u53e5\u4e0d\u4f1a\u88ab\u6267\u884c.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f8b\u5982\uff1a\u5b9a\u4e49\u6a21\u5757size.py\uff0c\u4f7f\u7528try\u8bed\u53e5\u6355\u83b7\u5f02\u5e38\uff0c\u5982\u679c\u6ca1\u6709\u6355\u83b7\u5230\u5c06\u6267\u884celse\u8bed\u53e5\u4e2d\u7684\u4ee3\u7801\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"595\" height=\"185\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/09\/26-1.png\" alt=\"\" class=\"wp-image-2251\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/09\/26-1.png 595w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/09\/26-1-300x93.png 300w\" sizes=\"auto, (max-width: 595px) 100vw, 595px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3\u3001try&#8230;except&#8230;finally\u8bed\u53e5<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b8c\u6574\u7684\u5f02\u5e38\u5904\u7406\u8bed\u53e5\u5e94\u8be5\u5305\u542bfinally\u4ee3\u7801\u5757\uff0c\u901a\u5e38\u60c5\u51b5\u4e0b\u65e0\u8bba\u5f02\u5e38\u6709\u65e0\u53d1\u751f\uff0cfinally\u4e2d\u7684\u4ee3\u7801\u5757\u90fd\u4f1a\u88ab\u6267\u884c\uff0c\u8bed\u6cd5\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>try:\n    block1\nexcept exceptionname as a:\n    block2\nfinally:\n    block3<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u53ef\u4ee5\u5c06\u65e0\u8bba\u662f\u5426\u51fa\u73b0\u5f02\u5e38\u90fd\u8981\u6267\u884c\u7684\u4ee3\u7801\u5757\u52a0\u5165\u5230finally\u8bed\u53e5\u5757\u4e2d\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8bf4\u660e\uff1a\u4f7f\u7528except\u8bed\u53e5\u662f\u4e3a\u4e86\u5904\u7406\u5f02\u5e38\uff0c\u65e0\u8bba\u662f\u5426\u53d1\u751f\u5f02\u5e38\uff0cfinally\u4e2d\u7684\u4ee3\u7801\u90fd\u4f1a\u88ab\u6267\u884c\uff0c\u5982\u679c\u5206\u914d\u4e86\u6709\u9650\u7684\u8d44\u6e90(\u5982\u6253\u5f00\u6587\u4ef6)\uff0c\u5219\u5e94\u5c06\u91ca\u653e\u8fd9\u4e9b\u8d44\u6e90\u7684\u4ee3\u7801\u653e\u5165\u5230finally\u4ee3\u7801\u5757\u4e2d\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f8b\u5982\uff1a\u5b9a\u4e49\u6a21\u5757size.py<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"597\" height=\"217\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/09\/27-1.png\" alt=\"\" class=\"wp-image-2252\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/09\/27-1.png 597w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/09\/27-1-300x109.png 300w\" sizes=\"auto, (max-width: 597px) 100vw, 597px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">4\u3001\u4f7f\u7528raise\u8bed\u53e5\u629b\u51fa\u5f02\u5e38<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u67d0\u4e2a\u51fd\u6570\u6216\u8005\u65b9\u6cd5\u53ef\u80fd\u4ea7\u751f\u5f02\u5e38\uff0c\u4f46\u662f\u4e0d\u60f3\u5728\u5f53\u524d\u51fd\u6570\u6216\u8005\u65b9\u6cd5\u4e2d\u5904\u7406\u8fd9\u4e2a\u5f02\u5e38\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528raise\u8bed\u53e5\u5728\u5f53\u524d\u51fd\u6570\u6216\u8005\u65b9\u6cd5\u4e2d\u629b\u51fa\u5f02\u5e38\uff0c\u8bed\u6cd5\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">raise  exceptionname<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u53c2\u6570\u8bf4\u660e\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>exceptionname\uff1a\u8868\u793a\u53ef\u9009\u53c2\u6570\uff0c\u7528\u4e8e\u6307\u5b9a\u5f02\u5e38\u540d\u79f0\u4ee5\u53ca\u5f02\u5e38\u4fe1\u606f\u7684\u76f8\u5173\u63cf\u8ff0\uff0c\u5982\u679c\u7701\u7565\uff0c\u90a3\u4e48\u4f1a\u5c06\u5f53\u524d\u9519\u8bef\u4fe1\u606f\u539f\u6837\u8f93\u51fa\u3002<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f8b\u5982\uff1a\u5b9a\u4e49\u51fd\u6570\uff0c\u5e76\u4ece\u952e\u76d8\u8f93\u5165\u4e24\u4e2a\u6570\u5b57\uff0c\u5c06\u6570\u5b57\u505a\u6bd4\u8f83\uff0c\u5982\u679c\u5b58\u5728\u5f02\u5e38\u5c06\u629b\u51fa\uff0c\u4e0b\u65b9\u8c03\u7528\u7684\u65f6\u5019\u4f1a\u5904\u7406\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"594\" height=\"212\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/09\/12-3.png\" alt=\"\" class=\"wp-image-2263\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/09\/12-3.png 594w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/09\/12-3-300x107.png 300w\" sizes=\"auto, (max-width: 594px) 100vw, 594px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">5\u3001\u81ea\u5b9a\u4e49\u5f02\u5e38\u7c7b\uff0c\u5e76\u4f7f\u7528raise\u629b\u51fa\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"693\" height=\"310\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/2-12.png\" alt=\"\" class=\"wp-image-15341\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/2-12.png 693w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/2-12-300x134.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/2-12-600x268.png 600w\" sizes=\"auto, (max-width: 693px) 100vw, 693px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u7b2c3\u884c\uff1a\u81ea\u5b9a\u4e49\u5f02\u5e38\u7c7b\uff0c\u540d\u5b57\u4e3aIntValueExcept\uff0c<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u5e76\u4e14\u4e00\u5b9a\u8981\u7ee7\u627fException\u624d\u884c<\/mark><\/li>\n\n\n\n<li>\u7b2c8\u884c\uff1a\u5982\u679c\u51fd\u6570\u63a5\u6536\u7684\u53c2\u6570\u4e0d\u662f100\uff0c\u5c06\u629b\u51fa\u9519\u8bef<\/li>\n\n\n\n<li>\u7b2c11\u884c\uff1a\u8c03\u7528\u51fd\u6570\u5e76\u6355\u83b7\u9519\u8bef<\/li>\n\n\n\n<li>\u7b2c12\u884c\uff1a\u6355\u83b7\u9519\u8bef\u540e\u6253\u5370\u9519\u8bef\u5185\u5bb9<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"696\" height=\"67\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/3-11.png\" alt=\"\" class=\"wp-image-15342\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/3-11.png 696w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/3-11-300x29.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/3-11-600x58.png 600w\" sizes=\"auto, (max-width: 696px) 100vw, 696px\" \/><\/figure>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\u610f\uff1a\u81ea\u5b9a\u4e49\u5f02\u5e38\u7c7b\u9700\u8981\u7ee7\u627fException\u7684\uff0c\u7136\u540e\u7c7b\u4f53\u76f4\u63a5\u4f7f\u7528pass\u5373\u53ef<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">6\u3001\u4f7f\u7528Exception\u6765\u6355\u83b7\u6240\u6709\u9519\u8bef<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762\u4f8b\u5b50\u521b\u5efa\u4e00\u4e2agong.txt\u6587\u4ef6\u5939\uff0c\u7136\u540e\u6253\u5f00\u8fd9\u4e2a\u6587\u4ef6\u5939\uff0c\u6b64\u65f6\u7b2c\u4e00\u4e2a\u5f02\u5e38\u4e0d\u4f1a\u88ab\u89e6\u53d1\uff0c\u56e0\u4e3agong.txt\u786e\u5b9e\u5b58\u5728\uff0c\u4f46\u662f\u7b2c\u4e8c\u4e2a\u4f1a\u89e6\u53d1\uff0c\u56e0\u4e3agong.txt\u4e0d\u662f\u6587\u4ef6\u800c\u662f\u6587\u4ef6\u5939\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"693\" height=\"241\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/3-10.png\" alt=\"\" class=\"wp-image-15334\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/3-10.png 693w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/3-10-300x104.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/3-10-600x209.png 600w\" sizes=\"auto, (max-width: 693px) 100vw, 693px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"694\" height=\"65\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/4-7.png\" alt=\"\" class=\"wp-image-15335\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/4-7.png 694w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/4-7-300x28.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/4-7-600x56.png 600w\" sizes=\"auto, (max-width: 694px) 100vw, 694px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4fee\u6539\u4e0a\u9762\u4f8b\u5b50\uff0c\u5b9a\u4e49\u6587\u4ef6\u6743\u9650\u5f02\u5e38\uff0c\u5e76\u5220\u9664gong.txt\uff0c\u518d\u6b21\u6267\u884c\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"692\" height=\"236\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/5-8.png\" alt=\"\" class=\"wp-image-15338\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/5-8.png 692w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/5-8-300x102.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/5-8-600x205.png 600w\" sizes=\"auto, (max-width: 692px) 100vw, 692px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"696\" height=\"62\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/6-9.png\" alt=\"\" class=\"wp-image-15339\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/6-9.png 696w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/6-9-300x27.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/10\/6-9-600x53.png 600w\" sizes=\"auto, (max-width: 696px) 100vw, 696px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ece\u4e0a\u9762\u4e24\u4e2a\u4f8b\u5b50\u53ef\u4ee5\u770b\u51fa\uff0cException\u53ef\u4ee5\u6355\u83b7\u5168\u90e8\u5f02\u5e38\uff0c\u5e76\u6839\u636e \u5f02\u5e38\u7c7b\u578b\u6253\u5370\u5bf9\u5e94\u7684\u9519\u8bef\u4fe1\u606f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7a0b\u5e8f\u8fd0\u884c\u65f6\uff0c\u7ecf\u5e38\u4f1a\u51fa\u73b0\u5404\u79cd\u5404\u6837\u7684\u9519\u8bef\uff0c\u8fd9\u4e9b\u9519\u8bef\u7edf\u79f0\u4e3a\u5f02\u5e38\u3002 python\u4e2d\u5e38\u89c1\u5f02\u5e38\uff1a \u5f02\u5e38 \u63cf\u8ff0 NameEr [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":2264,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38,29],"tags":[],"class_list":["post-2248","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","category-yunwei"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":8}},"_links":{"self":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/2248","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/comments?post=2248"}],"version-history":[{"count":13,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/2248\/revisions"}],"predecessor-version":[{"id":15344,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/2248\/revisions\/15344"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media\/2264"}],"wp:attachment":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2248"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2248"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}