{"id":1466,"date":"2020-05-22T23:44:25","date_gmt":"2020-05-22T14:44:25","guid":{"rendered":"https:\/\/obenkyolab.com\/?p=1466"},"modified":"2020-05-22T23:46:07","modified_gmt":"2020-05-22T14:46:07","slug":"python-%e8%be%9e%e6%9b%b8%e5%9e%8b%e3%81%ae%e5%9f%ba%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/obenkyolab.com\/?p=1466","title":{"rendered":"Python \u8f9e\u66f8\u578b\u306e\u57fa\u672c"},"content":{"rendered":"\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_80 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/obenkyolab.com\/?p=1466\/#%E7%9B%AE%E7%9A%84\" >\u76ee\u7684<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/obenkyolab.com\/?p=1466\/#%E8%BE%9E%E6%9B%B8%E5%9E%8B%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AE%E4%BD%9C%E6%88%90\" >\u8f9e\u66f8\u578b\u30c7\u30fc\u30bf\u306e\u4f5c\u6210<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/obenkyolab.com\/?p=1466\/#%E8%A6%81%E7%B4%A0%E3%81%AE%E5%8F%96%E3%82%8A%E5%87%BA%E3%81%97\" >\u8981\u7d20\u306e\u53d6\u308a\u51fa\u3057<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/obenkyolab.com\/?p=1466\/#%E5%85%A8%E3%82%AD%E3%83%BC%E3%81%AE%E5%8F%96%E5%BE%97\" >\u5168\u30ad\u30fc\u306e\u53d6\u5f97<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/obenkyolab.com\/?p=1466\/#%E5%85%A8%E5%80%A4%E3%81%AE%E5%8F%96%E5%BE%97\" >\u5168\u5024\u306e\u53d6\u5f97<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/obenkyolab.com\/?p=1466\/#%E5%85%A8%E3%82%AD%E3%83%BC%E3%81%8A%E3%82%88%E3%81%B3%E5%80%A4%E3%81%AE%E5%8F%96%E5%BE%97\" >\u5168\u30ad\u30fc\u304a\u3088\u3073\u5024\u306e\u53d6\u5f97<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/obenkyolab.com\/?p=1466\/#%E3%83%AA%E3%82%B9%E3%83%88%E5%9E%8B%E3%81%8B%E3%82%89%E8%BE%9E%E6%9B%B8%E5%9E%8B%E3%81%B8%E3%81%AE%E5%A4%89%E6%8F%9B\" >\u30ea\u30b9\u30c8\u578b\u304b\u3089\u8f9e\u66f8\u578b\u3078\u306e\u5909\u63db<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/obenkyolab.com\/?p=1466\/#%E3%82%AD%E3%83%BC%E3%81%AE%E6%9C%89%E7%84%A1%E7%A2%BA%E8%AA%8D\" >\u30ad\u30fc\u306e\u6709\u7121\u78ba\u8a8d<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/obenkyolab.com\/?p=1466\/#%E8%A6%81%E7%B4%A0%E3%81%AE%E8%BF%BD%E5%8A%A0\" >\u8981\u7d20\u306e\u8ffd\u52a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/obenkyolab.com\/?p=1466\/#%E8%A6%81%E7%B4%A0%E3%81%AE%E5%89%8A%E9%99%A4\" >\u8981\u7d20\u306e\u524a\u9664<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/obenkyolab.com\/?p=1466\/#%E8%BE%9E%E6%9B%B8%E3%81%AE%E7%B5%90%E5%90%88\" >\u8f9e\u66f8\u306e\u7d50\u5408<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/obenkyolab.com\/?p=1466\/#%E8%A6%81%E7%B4%A0%E3%81%AE%E5%85%A8%E5%89%8A%E9%99%A4\" >\u8981\u7d20\u306e\u5168\u524a\u9664<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E7%9B%AE%E7%9A%84\"><\/span>\u76ee\u7684<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Python3\u3067\u4fbf\u5229\u306a\u8f9e\u66f8\u578b\u306e\u57fa\u672c\u7684\u306a\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u899a\u3048\u308b\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%BE%9E%E6%9B%B8%E5%9E%8B%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AE%E4%BD%9C%E6%88%90\"><\/span>\u8f9e\u66f8\u578b\u30c7\u30fc\u30bf\u306e\u4f5c\u6210<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n&gt;&gt;&gt; test_dict= {&#039;key0&#039;:&#039;value0&#039;,&#039;key1&#039;:&#039;value1&#039;,&#039;key2&#039;:&#039;value2&#039;}\n&gt;&gt;&gt; test_dict\n{&#039;key0&#039;: &#039;value0&#039;, &#039;key1&#039;: &#039;value1&#039;}\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%A6%81%E7%B4%A0%E3%81%AE%E5%8F%96%E3%82%8A%E5%87%BA%E3%81%97\"><\/span>\u8981\u7d20\u306e\u53d6\u308a\u51fa\u3057<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n&gt;&gt;&gt; test_dict&#x5B;&#039;key0&#039;]\n&#039;value0&#039;\n\n&gt;&gt;&gt; test_dict.get(&#039;key0&#039;)\n&#039;value0&#039;\n\n&gt;&gt;&gt;test_dict.get(&#039;key3&#039;,&#039;No value3&#039;)\n&#039;No value3&#039;\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%85%A8%E3%82%AD%E3%83%BC%E3%81%AE%E5%8F%96%E5%BE%97\"><\/span>\u5168\u30ad\u30fc\u306e\u53d6\u5f97<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n&gt;&gt;&gt; test_dict.keys()\ndict_keys(&#x5B;&#039;key0&#039;, &#039;key1&#039;, &#039;key2&#039;])\n\n&gt;&gt;&gt;list(test_dict.keys())\n&#x5B;&#039;key0&#039;, &#039;key1&#039;, &#039;key2&#039;]\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%85%A8%E5%80%A4%E3%81%AE%E5%8F%96%E5%BE%97\"><\/span>\u5168\u5024\u306e\u53d6\u5f97<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n&gt;&gt;&gt; test_dict.values()\ndict_values(&#x5B;&#039;value0&#039;, &#039;value1&#039;, &#039;value2&#039;])\n\n&gt;&gt;&gt; list(test_dict.values())\n&#x5B;&#039;value0&#039;, &#039;value1&#039;, &#039;value2&#039;]\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%85%A8%E3%82%AD%E3%83%BC%E3%81%8A%E3%82%88%E3%81%B3%E5%80%A4%E3%81%AE%E5%8F%96%E5%BE%97\"><\/span>\u5168\u30ad\u30fc\u304a\u3088\u3073\u5024\u306e\u53d6\u5f97<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n&gt;&gt;&gt; test_dict.items()\ndict_items(&#x5B;(&#039;key0&#039;, &#039;value0&#039;), (&#039;key1&#039;, &#039;value1&#039;), (&#039;key2&#039;, &#039;value2&#039;)])\n\n&gt;&gt;&gt; list(test_dict.items())\n&#x5B;(&#039;key0&#039;, &#039;value0&#039;), (&#039;key1&#039;, &#039;value1&#039;), (&#039;key2&#039;, &#039;value2&#039;)]\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E3%83%AA%E3%82%B9%E3%83%88%E5%9E%8B%E3%81%8B%E3%82%89%E8%BE%9E%E6%9B%B8%E5%9E%8B%E3%81%B8%E3%81%AE%E5%A4%89%E6%8F%9B\"><\/span>\u30ea\u30b9\u30c8\u578b\u304b\u3089\u8f9e\u66f8\u578b\u3078\u306e\u5909\u63db<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n&gt;&gt;&gt; test_list = &#x5B;&#x5B;&#039;key0&#039;,&#039;value0&#039;],&#x5B;&#039;key1&#039;,&#039;value1&#039;],&#x5B;&#039;key2&#039;,&#039;value2&#039;]]\n&gt;&gt;&gt; dict(test_list)\n{&#039;key0&#039;: &#039;value0&#039;, &#039;key1&#039;: &#039;value1&#039;, &#039;key2&#039;: &#039;value2&#039;}\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E3%82%AD%E3%83%BC%E3%81%AE%E6%9C%89%E7%84%A1%E7%A2%BA%E8%AA%8D\"><\/span>\u30ad\u30fc\u306e\u6709\u7121\u78ba\u8a8d<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n&gt;&gt;&gt; &#039;key3&#039; in test_dict\nFalse\n\n&gt;&gt;&gt; &#039;key2&#039; in test_dict\nTrue\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%A6%81%E7%B4%A0%E3%81%AE%E8%BF%BD%E5%8A%A0\"><\/span>\u8981\u7d20\u306e\u8ffd\u52a0<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n&gt;&gt;&gt; test_dict&#x5B;&#039;key3&#039;] = &#039;value3&#039;\n&gt;&gt;&gt; test_dict\n{&#039;key0&#039;: &#039;value0&#039;, &#039;key1&#039;: &#039;value1&#039;, &#039;key2&#039;: &#039;value2&#039;, &#039;key3&#039;: &#039;value3&#039;}\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%A6%81%E7%B4%A0%E3%81%AE%E5%89%8A%E9%99%A4\"><\/span>\u8981\u7d20\u306e\u524a\u9664<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n&gt;&gt;&gt; del test_dict&#x5B;&#039;key3&#039;]\n&gt;&gt;&gt; test_dict\n{&#039;key0&#039;: &#039;value0&#039;, &#039;key1&#039;: &#039;value1&#039;, &#039;key2&#039;: &#039;value2&#039;}\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%BE%9E%E6%9B%B8%E3%81%AE%E7%B5%90%E5%90%88\"><\/span>\u8f9e\u66f8\u306e\u7d50\u5408<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n&gt;&gt;&gt; test_dict2= {&#039;key3&#039;:&#039;value3&#039;,&#039;key4&#039;:&#039;value4&#039;}\n&gt;&gt;&gt; test_dict.update(test_dict2)\n&gt;&gt;&gt; test_dict\n{&#039;key0&#039;: &#039;value0&#039;,\n &#039;key1&#039;: &#039;value1&#039;,\n &#039;key2&#039;: &#039;value2&#039;,\n &#039;key3&#039;: &#039;value3&#039;,\n &#039;key4&#039;: &#039;value4&#039;}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%A6%81%E7%B4%A0%E3%81%AE%E5%85%A8%E5%89%8A%E9%99%A4\"><\/span>\u8981\u7d20\u306e\u5168\u524a\u9664<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n&gt;&gt;&gt; test_dict.clear()\n&gt;&gt;&gt; test_dict\n{}\n<\/pre><\/div>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u7684 Python3\u3067\u4fbf\u5229\u306a\u8f9e\u66f8\u578b\u306e\u57fa\u672c\u7684\u306a\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u899a\u3048\u308b\u3002 &#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":1218,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"ja","_original_post":"https:\/\/obenkyolab.com\/?p=1466","footnotes":""},"categories":[7],"tags":[],"class_list":["post-1466","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","ja"],"_links":{"self":[{"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/posts\/1466","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1466"}],"version-history":[{"count":13,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/posts\/1466\/revisions"}],"predecessor-version":[{"id":1479,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/posts\/1466\/revisions\/1479"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/media\/1218"}],"wp:attachment":[{"href":"https:\/\/obenkyolab.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1466"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1466"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1466"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}