{"id":5342,"date":"2022-01-04T09:26:13","date_gmt":"2022-01-04T00:26:13","guid":{"rendered":"http:\/\/hituji1012.xsrv.jp\/?p=798"},"modified":"2026-08-01T13:50:43","modified_gmt":"2026-08-01T04:50:43","slug":"97","status":"publish","type":"post","link":"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/","title":{"rendered":"\u3010Python\u3011dict\u306e\u4f7f\u3044\u65b9"},"content":{"rendered":"\n<p>\u4eca\u56de\u306f\u914d\u5217\u3068\u540c\u3058\u3088\u3046\u306a\u3001\u30c7\u30fc\u30bf\u306e\u96c6\u307e\u308a\u3067\u3042\u308bdict(\u8f9e\u66f8)\u306b\u3064\u3044\u3066\u7fd2\u5f97\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u914d\u5217\u306f\u3001\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3068\u304d\u306b\u306f\u3001index(\u914d\u5217\u756a\u53f7)\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<p>dict\u306e\u8f9e\u66f8\u578b\u306f\u8f9e\u66f8\u3068\u547c\u3070\u308c\u308b\u901a\u308a\u3001\u7d22\u5f15\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u540d\u524d\u306e\u30c7\u30fc\u30bf\u304c\u6b32\u3057\u3044\u5834\u5408\u3001\u7d22\u5f15\u3068\u3057\u3066\u300c\u540d\u524d\u300d\u3068\u3059\u308b\u3053\u3068\u3067\u30c7\u30fc\u30bf\u304c\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u8a73\u3057\u304f\u307f\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u672c\u8a18\u4e8b\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/p>\n<p><span style=\"color: #ff0000;\"><a href=\"http:\/\/hituji1012.xsrv.jp\/wp-content\/uploads\/2021\/01\/python9.zip\" style=\"color: #ff0000;\">&gt;&gt; \u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9(jupyter notebook)<\/a><\/span><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_38 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\">\u76ee\u6b21<\/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\" style=\"display: none;\"><label for=\"item\" aria-label=\"Table of Content\"><span style=\"display: flex;align-items: center;width: 35px;height: 30px;justify-content: center;\"><svg style=\"fill: #444444;color:#444444\" 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: #444444;color:#444444\" 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><\/label><input type=\"checkbox\" id=\"item\"><\/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:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#dict%E8%BE%9E%E6%9B%B8%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6\" title=\"dict(\u8f9e\u66f8)\u306b\u3064\u3044\u3066\">dict(\u8f9e\u66f8)\u306b\u3064\u3044\u3066<\/a><ul class='ez-toc-list-level-3'><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#dict%E3%81%AF%E3%81%9D%E3%81%AE%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AB%E5%90%8D%E7%A7%B0%E3%81%8C%E3%81%82%E3%82%8B%E3%81%A8%E6%89%B1%E3%81%84%E3%82%84%E3%81%99%E3%81%84%E3%83%87%E3%83%BC%E3%82%BF%E3%81%A7%E4%BD%BF%E3%81%86\" title=\"dict\u306f\u305d\u306e\u30c7\u30fc\u30bf\u306b\u540d\u79f0\u304c\u3042\u308b\u3068\u6271\u3044\u3084\u3059\u3044\u30c7\u30fc\u30bf\u3067\u4f7f\u3046\">dict\u306f\u305d\u306e\u30c7\u30fc\u30bf\u306b\u540d\u79f0\u304c\u3042\u308b\u3068\u6271\u3044\u3084\u3059\u3044\u30c7\u30fc\u30bf\u3067\u4f7f\u3046<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#dict%E8%BE%9E%E6%9B%B8%E3%81%AE%E5%9F%BA%E6%9C%AC\" title=\"dict(\u8f9e\u66f8)\u306e\u57fa\u672c\">dict(\u8f9e\u66f8)\u306e\u57fa\u672c<\/a><ul class='ez-toc-list-level-3'><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#dict%E3%83%87%E3%83%BC%E3%82%BF%E3%82%92%E3%81%A4%E3%81%8F%E3%82%8B\" title=\"dict\u30c7\u30fc\u30bf\u3092\u3064\u304f\u308b\">dict\u30c7\u30fc\u30bf\u3092\u3064\u304f\u308b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#%E7%B5%84%E3%81%BF%E8%BE%BC%E3%81%BF%E9%96%A2%E6%95%B0dict%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6%E4%BD%9C%E3%82%8B\" title=\"\u7d44\u307f\u8fbc\u307f\u95a2\u6570dict\u3092\u4f7f\u3063\u3066\u4f5c\u308b\">\u7d44\u307f\u8fbc\u307f\u95a2\u6570dict\u3092\u4f7f\u3063\u3066\u4f5c\u308b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#%E3%82%AD%E3%83%BC%E3%81%A8%E5%80%A4%E3%82%92%E5%8F%96%E3%82%8A%E5%87%BA%E3%81%99%E3%81%AB%E3%81%AFkeyvalueitem%E3%83%A1%E3%82%BD%E3%83%83%E3%83%89%E3%82%92%E4%BD%BF%E3%81%86\" title=\"\u30ad\u30fc\u3068\u5024\u3092\u53d6\u308a\u51fa\u3059\u306b\u306fkey,value,item\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046\">\u30ad\u30fc\u3068\u5024\u3092\u53d6\u308a\u51fa\u3059\u306b\u306fkey,value,item\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AE%E6%9B%B4%E6%96%B0%E3%81%A8%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AE%E8%BF%BD%E5%8A%A0\" title=\"\u30c7\u30fc\u30bf\u306e\u66f4\u65b0\u3068\u30c7\u30fc\u30bf\u306e\u8ffd\u52a0\">\u30c7\u30fc\u30bf\u306e\u66f4\u65b0\u3068\u30c7\u30fc\u30bf\u306e\u8ffd\u52a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#%E3%83%87%E3%83%BC%E3%82%BF%E3%82%92%E7%B5%90%E5%90%88%E3%81%99%E3%82%8B%E3%83%A1%E3%82%BD%E3%83%83%E3%83%89%E3%81%AF2%E7%A8%AE%E9%A1%9E\" title=\"\u30c7\u30fc\u30bf\u3092\u7d50\u5408\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u306f2\u7a2e\u985e\">\u30c7\u30fc\u30bf\u3092\u7d50\u5408\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u306f2\u7a2e\u985e<\/a><ul class='ez-toc-list-level-4'><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#update%E3%83%A1%E3%82%BD%E3%83%83%E3%83%89\" title=\"update\u30e1\u30bd\u30c3\u30c9\">update\u30e1\u30bd\u30c3\u30c9<\/a><ul class='ez-toc-list-level-5'><li class='ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#%E9%87%8D%E8%A4%87%E3%81%8C%E3%81%AA%E3%81%8F%E3%80%81%E3%83%87%E3%83%BC%E3%82%BF%E3%81%8C%E8%BF%BD%E5%8A%A0%E3%81%95%E3%82%8C%E3%82%8B%E5%A0%B4%E5%90%88\" title=\"\u91cd\u8907\u304c\u306a\u304f\u3001\u30c7\u30fc\u30bf\u304c\u8ffd\u52a0\u3055\u308c\u308b\u5834\u5408\">\u91cd\u8907\u304c\u306a\u304f\u3001\u30c7\u30fc\u30bf\u304c\u8ffd\u52a0\u3055\u308c\u308b\u5834\u5408<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#department%E3%81%8C%E9%87%8D%E8%A4%87%E3%81%97%E3%81%A6%E3%81%84%E3%82%8B%E5%A0%B4%E5%90%88\" title=\"department\u304c\u91cd\u8907\u3057\u3066\u3044\u308b\u5834\u5408\">department\u304c\u91cd\u8907\u3057\u3066\u3044\u308b\u5834\u5408<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#dict%E3%83%A1%E3%82%BD%E3%83%83%E3%83%89\" title=\"dict\u30e1\u30bd\u30c3\u30c9\">dict\u30e1\u30bd\u30c3\u30c9<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#%E5%89%8A%E9%99%A4%E3%81%99%E3%82%8B%E3%83%A1%E3%82%BD%E3%83%83%E3%83%89%E3%81%AF4%E7%A8%AE%E9%A1%9E\" title=\"\u524a\u9664\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u306f4\u7a2e\u985e\">\u524a\u9664\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u306f4\u7a2e\u985e<\/a><ul class='ez-toc-list-level-4'><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#clear%E5%85%A8%E5%89%8A%E9%99%A4%E3%83%A1%E3%82%BD%E3%83%83%E3%83%89\" title=\"clear(\u5168\u524a\u9664)\u30e1\u30bd\u30c3\u30c9\">clear(\u5168\u524a\u9664)\u30e1\u30bd\u30c3\u30c9<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#pop%E3%83%A1%E3%82%BD%E3%83%83%E3%83%89\" title=\"pop\u30e1\u30bd\u30c3\u30c9\">pop\u30e1\u30bd\u30c3\u30c9<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#popitem%E3%83%A1%E3%82%BD%E3%83%83%E3%83%89\" title=\"popitem\u30e1\u30bd\u30c3\u30c9\">popitem\u30e1\u30bd\u30c3\u30c9<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#del\" title=\"del\">del<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#dict%E8%BE%9E%E6%9B%B8%E3%81%AE%E5%BF%9C%E7%94%A8\" title=\"dict(\u8f9e\u66f8)\u306e\u5fdc\u7528\">dict(\u8f9e\u66f8)\u306e\u5fdc\u7528<\/a><ul class='ez-toc-list-level-3'><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#for%E6%96%87%E3%81%A7%E4%BD%BF%E3%81%86\" title=\"for\u6587\u3067\u4f7f\u3046\">for\u6587\u3067\u4f7f\u3046<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#%E5%85%A5%E3%82%8C%E5%AD%90%E6%A7%8B%E9%80%A0%E3%81%AE%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AB%E3%81%99%E3%82%8B\" title=\"\u5165\u308c\u5b50\u69cb\u9020\u306e\u30c7\u30fc\u30bf\u306b\u3059\u308b\">\u5165\u308c\u5b50\u69cb\u9020\u306e\u30c7\u30fc\u30bf\u306b\u3059\u308b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#%E3%82%AD%E3%83%BC%E3%81%AE%E6%9C%89%E7%84%A1%E3%81%AFin%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6%E7%A2%BA%E8%AA%8D\" title=\"\u30ad\u30fc\u306e\u6709\u7121\u306fin\u3092\u4f7f\u3063\u3066\u78ba\u8a8d\">\u30ad\u30fc\u306e\u6709\u7121\u306fin\u3092\u4f7f\u3063\u3066\u78ba\u8a8d<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#%E4%B8%A6%E3%81%B9%E6%9B%BF%E3%81%88%E3%81%AB%E3%81%AFsorted%E3%82%92%E4%BD%BF%E3%81%86\" title=\"\u4e26\u3079\u66ff\u3048\u306b\u306fsorted\u3092\u4f7f\u3046\">\u4e26\u3079\u66ff\u3048\u306b\u306fsorted\u3092\u4f7f\u3046<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/#%E3%81%BE%E3%81%A8%E3%82%81\" title=\"\u307e\u3068\u3081\">\u307e\u3068\u3081<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"dict%E8%BE%9E%E6%9B%B8%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6\"><\/span>dict(\u8f9e\u66f8)\u306b\u3064\u3044\u3066<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>dict\u306f\u30ad\u30fc\uff08\u7d22\u5f15\uff09\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3067\u3059\u306e\u3067\u3001dict\u306e\u5ba3\u8a00\u306f\u6b21\u306e\u3088\u3046\u306b\u3001<strong>\u30ad\u30fc<\/strong>:\u00a0<strong>\u30c7\u30fc\u30bf<\/strong>\u3092\u3044\u304f\u3064\u3082\u5165\u308c\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/tetsumag.com\/wp-content\/uploads\/2021\/01\/python9_dict_1-2-300x273-1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-9043\" src=\"https:\/\/tetsumag.com\/wp-content\/uploads\/2021\/01\/python9_dict_1-2-300x273-1.png\" alt=\"\" width=\"300\" height=\"273\" \/><\/a><\/p>\n<p>\u30ad\u30fc: \u30c7\u30fc\u30bf\u306f\u30ab\u30f3\u30de\u300c,\u300d\u3067\u533a\u5207\u308a\u3001\u305d\u308c\u3089\u3092\u6ce2\u304b\u3063\u3053\u3067\u56f2\u3080\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u306e\u30b3\u30fc\u30c9\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"dict\u306e\u4f8b\">data1 = 1\r\ndata2 = 2\r\ndata3 = 3\r\ndict_a = {\r\n    \"key1\": data1,\r\n    \"key2\": data2,\r\n    \"key3\": data3,\r\n}<\/pre>\n<div>\n<div style=\"height: 15px;\"><span style=\"background: #91D8AC; padding: 10px 10px; border-radius: 10px; color: #ffffff; font-weight: bold; margin-left: 10px;\">\u6ce8\u610f\u30dd\u30a4\u30f3\u30c8<\/span><\/div>\n<div style=\"padding: 30px 15px 10px; border-radius: 5px; border: 8px solid #91D8AC;\">\n<ol>\n<li>\u30ad\u30fc\u5024\u306f\u6570\u5024\u3067\u3082\u52d5\u304d\u307e\u3059\u304c\u3001\u304a\u52e7\u3081\u3057\u307e\u305b\u3093\u30021\u3067\u30821.0\u3067\u3082\u52d5\u304f\u3002<\/li>\n<li>\u30ad\u30fc\u5024\u306f\u82f1\u8a9e\u3067\u308f\u304b\u308a\u3084\u3059\u3044\u540d\u524d\u304c\u826f\u3044<\/li>\n<li>\u6700\u5f8c\u306e\u30c7\u30fc\u30bf(data3)\u306e\u5f8c\u308d\u306e\u30ab\u30f3\u30de\u306f\u3042\u3063\u3066\u3082\u306a\u304f\u3066\u3082\u826f\u3044<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<h3><span class=\"ez-toc-section\" id=\"dict%E3%81%AF%E3%81%9D%E3%81%AE%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AB%E5%90%8D%E7%A7%B0%E3%81%8C%E3%81%82%E3%82%8B%E3%81%A8%E6%89%B1%E3%81%84%E3%82%84%E3%81%99%E3%81%84%E3%83%87%E3%83%BC%E3%82%BF%E3%81%A7%E4%BD%BF%E3%81%86\"><\/span>dict\u306f\u305d\u306e\u30c7\u30fc\u30bf\u306b\u540d\u79f0\u304c\u3042\u308b\u3068\u6271\u3044\u3084\u3059\u3044\u30c7\u30fc\u30bf\u3067\u4f7f\u3046<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>dict\u306f\u305d\u306e\u30c7\u30fc\u30bf\u306b\u540d\u79f0\u304c\u3042\u308b\u3068\u6271\u3044\u3084\u3059\u3044\u30c7\u30fc\u30bf\u3067\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u5f93\u696d\u54e1\u306e\u540d\u524d\u3001ID\u3001\u90e8\u9580\u3068\u304b\u306fdict\u306e\u65b9\u304c\u53d6\u308a\u6271\u3044\u3084\u3059\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<table style=\"border-collapse: collapse; width: 70.8515%; height: 138px;\">\n<tbody>\n<tr style=\"height: 46px;\">\n<td style=\"width: 33.3333%; background-color: #424242; text-align: center; height: 46px;\"><span style=\"color: #ffffff;\"><strong>ID<\/strong><\/span><\/td>\n<td style=\"width: 33.3333%; background-color: #424242; text-align: center; height: 46px;\"><span style=\"color: #ffffff;\"><strong>\u540d\u524d<\/strong><\/span><\/td>\n<td style=\"width: 33.3333%; background-color: #424242; text-align: center; height: 46px;\"><span style=\"color: #ffffff;\"><strong>\u90e8\u9580<\/strong><\/span><\/td>\n<\/tr>\n<tr style=\"height: 46px;\">\n<td style=\"width: 33.3333%; height: 46px;\">1234<\/td>\n<td style=\"width: 33.3333%; height: 46px;\">\u9234\u6728<\/td>\n<td style=\"width: 33.3333%; height: 46px;\">\u55b6\u696d<\/td>\n<\/tr>\n<tr style=\"height: 46px;\">\n<td style=\"width: 33.3333%; height: 46px;\">1222<\/td>\n<td style=\"width: 33.3333%; height: 46px;\">\u4f50\u85e4<\/td>\n<td style=\"width: 33.3333%; height: 46px;\">\u7dcf\u52d9<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><span class=\"ez-toc-section\" id=\"dict%E8%BE%9E%E6%9B%B8%E3%81%AE%E5%9F%BA%E6%9C%AC\"><\/span>dict(\u8f9e\u66f8)\u306e\u57fa\u672c<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u3067\u306f\u3001dict\u3092\u4f7f\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"dict%E3%83%87%E3%83%BC%E3%82%BF%E3%82%92%E3%81%A4%E3%81%8F%E3%82%8B\"><\/span>dict\u30c7\u30fc\u30bf\u3092\u3064\u304f\u308b<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u5148\u307b\u3069\u306e\u5f93\u696d\u54e1\u306e\u8868\u304b\u3089\u4f5c\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\">employee = {\r\n    'id': '1234',\r\n    'name': '\u9234\u6728',\r\n    'department': '\u55b6\u696d',\r\n}\r\nprint(employee)<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">{'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}<\/pre>\n<p>\u307f\u3084\u3059\u304f\u3059\u308b\u305f\u3081\u306b\u3001dict\u3092\u4f5c\u308b\u3068\u304d\u306b\u6539\u884c\u3057\u3066\u3044\u307e\u3059\u304c\u30011\u884c\u3067\u3082OK\u3067\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\">employee = {'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}<\/pre>\n<p>\u30c7\u30fc\u30bf\u3092\u53d6\u308a\u51fa\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p><strong>employee[\u30ad\u30fc]<\/strong>\u3067\u53d6\u308a\u51fa\u305b\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\">print(emploee['id'])<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">1234<\/pre>\n<p>\u4e00\u4eba\u5206\u306e\u30c7\u30fc\u30bf\u3057\u304b\u4f5c\u308c\u3066\u3044\u307e\u305b\u3093\u306d\u3002<\/p>\n<p>\u4e8c\u4eba\u5206\u3092\u4f5c\u3063\u3066\u914d\u5217\u306b\u5165\u308c\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\">employee1 = {\r\n    'id': '1234',\r\n    'name': '\u9234\u6728',\r\n    'department': '\u55b6\u696d',\r\n}\r\nemployee2 = {\r\n    'id': '1222',\r\n    'name': '\u4f50\u85e4',\r\n    'department': '\u7dcf\u52d9',\r\n}\r\nemployees = [employee1, employee2]\r\nprint(employees)<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">[{'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}, {'id': '1222', 'name': '\u4f50\u85e4', 'department': '\u7dcf\u52d9'}]<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"%E7%B5%84%E3%81%BF%E8%BE%BC%E3%81%BF%E9%96%A2%E6%95%B0dict%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6%E4%BD%9C%E3%82%8B\"><\/span>\u7d44\u307f\u8fbc\u307f\u95a2\u6570dict\u3092\u4f7f\u3063\u3066\u4f5c\u308b<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u300cdict\u300d\u3068\u3044\u3046\u3001\u7d44\u307f\u8fbc\u307f\u95a2\u6570\u3092\u4f7f\u3063\u3066\u3082\u4f5c\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><span style=\"color: #ff0000;\"><b><a href=\"https:\/\/docs.python.org\/ja\/3\/library\/stdtypes.html#mapping-types-dict\" target=\"_blank\" rel=\"noopener\" style=\"color: #ff0000;\">&gt;&gt; python \u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a><\/b><\/span><\/p>\n<p>\u5148\u7a0b\u306e\u3001employee\u3068\u540c\u3058\u3082\u306e\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\"># employee = {'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}\r\n# \u3068\u540c\u3058\r\nemployee = dict(id=1234, name='\u9234\u6728', department='\u55b6\u696d')\r\nprint(employee)<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">{'id': 1234, 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}<\/pre>\n<p>\u540c\u3058\u30c7\u30fc\u30bf\u304c\u4f5c\u308c\u307e\u3059\u3002<\/p>\n<p>\u3053\u3061\u3089\u306f\u3001\u3042\u307e\u308a\u898b\u304b\u3051\u307e\u305b\u3093\u3002<\/p>\n<p>\u3069\u3061\u3089\u306e\u8a18\u8ff0\u304c\u3067\u304d\u3066\u3082\u3001\uff1f\uff1f\uff1f\u3068\u306a\u3089\u306a\u3044\u3088\u3046\u306b\u3001\u4e21\u65b9\u899a\u3048\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E3%82%AD%E3%83%BC%E3%81%A8%E5%80%A4%E3%82%92%E5%8F%96%E3%82%8A%E5%87%BA%E3%81%99%E3%81%AB%E3%81%AFkeyvalueitem%E3%83%A1%E3%82%BD%E3%83%83%E3%83%89%E3%82%92%E4%BD%BF%E3%81%86\"><\/span>\u30ad\u30fc\u3068\u5024\u3092\u53d6\u308a\u51fa\u3059\u306b\u306fkey,value,item\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>dict\u304b\u3089\u306f\u30ad\u30fc\u3068\u5024\u3092\u53d6\u308a\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u53d6\u308a\u51fa\u3059\u306b\u306f\u3001keys\u3001values\u3001items\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<p><span style=\"color: #ff0000;\"><strong><a href=\"https:\/\/docs.python.org\/ja\/3\/library\/stdtypes.html?highlight=dict#dict-views\" target=\"_blank\" rel=\"noopener\" style=\"color: #ff0000;\">&gt;&gt; python\u516c\u5f0f \u8f9e\u66f8\u30d3\u30e5\u30fc\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/a><\/strong><\/span><\/p>\n<p>\u30b3\u30fc\u30c9\u306b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\"># \u30ad\u30fc\r\nprint(employee.keys())\r\n# \u5024\r\nprint(employee.values())\r\n# \u30ad\u30fc\u3068\u5024\r\nprint(employee.items())<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">dict_keys(['id', 'name', 'department'])\r\ndict_values([1234, '\u9234\u6728', '\u55b6\u696d'])\r\ndict_items([('id', 1234), ('name', '\u9234\u6728'), ('department', '\u55b6\u696d')])<\/pre>\n<p>\u305d\u308c\u305e\u308c\u3001\u578b\u306flist\u3067\u306f\u306a\u3044\u306e\u3067\u3001list\u306b\u5909\u63db\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\"># \u578b\u306flist\u3067\u306f\u306a\u3044\r\nprint(type(employee.keys()))\r\n# list\u306b\u5909\u63db\r\nkey_list = list(employee.keys())\r\nprint(key_list)<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">class 'dict_keys';\r\n['id', 'name', 'department']<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AE%E6%9B%B4%E6%96%B0%E3%81%A8%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AE%E8%BF%BD%E5%8A%A0\"><\/span>\u30c7\u30fc\u30bf\u306e\u66f4\u65b0\u3068\u30c7\u30fc\u30bf\u306e\u8ffd\u52a0<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u66f4\u65b0\u3001\u8ffd\u52a0\u306e\u65b9\u6cd5\u306f\u540c\u3058\u3067\u3059\u3002<\/p>\n<div>\n<div style=\"height: 15px;\"><span style=\"background: #91D8AC; padding: 10px 10px; border-radius: 10px; color: #ffffff; font-weight: bold; margin-left: 10px;\">\u30c7\u30fc\u30bf\u306e\u66f4\u65b0\/\u30c7\u30fc\u30bf\u306e\u8ffd\u52a0<\/span><\/div>\n<div style=\"padding: 30px 15px 10px; border-radius: 5px; border: 8px solid #91D8AC;\">\n<p><strong>dict\u540d[\u30ad\u30fc\u5024] = \u30c7\u30fc\u30bf<\/strong><\/p>\n<\/div>\n<\/div>\n<p>\u30b3\u30fc\u30c9\u306b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u5f93\u696d\u54e1\u306e\u90e8\u9580\u304c\u5909\u308f\u3063\u3066\u3001\u5f79\u8077\u304c\u3064\u3044\u305f\u3068\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\">employee = {'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}\r\nprint(employee)\r\n# \u90e8\u9580\u5909\u66f4\r\nemployee['department'] = '\u958b\u767a'\r\n# \u5f79\u8077\u8ffd\u52a0\r\nemployee['position'] = '\u4fc2\u9577'\r\nprint(employee)<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">{'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}\r\n{'id': '1234', 'name': '\u9234\u6728', 'department': '\u958b\u767a', 'position': '\u4fc2\u9577'}<\/pre>\n<p>&nbsp;<\/p>\n<p>\u66f4\u65b0\u3068\u8ffd\u52a0\u306e\u524d\u5f8c\u3067\u30c7\u30fc\u30bf\u304c\u5909\u308f\u3063\u3066\u3001\u958b\u767a\u306e\u4fc2\u9577\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E3%83%87%E3%83%BC%E3%82%BF%E3%82%92%E7%B5%90%E5%90%88%E3%81%99%E3%82%8B%E3%83%A1%E3%82%BD%E3%83%83%E3%83%89%E3%81%AF2%E7%A8%AE%E9%A1%9E\"><\/span>\u30c7\u30fc\u30bf\u3092\u7d50\u5408\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u306f2\u7a2e\u985e<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u7d50\u5408\u306b\u306f2\u7a2e\u985e\u3042\u308a\u307e\u3059\u3002<\/p>\n<h4><span class=\"ez-toc-section\" id=\"update%E3%83%A1%E3%82%BD%E3%83%83%E3%83%89\"><\/span><strong>update\u30e1\u30bd\u30c3\u30c9<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u4e00\u3064\u76ee\u306fupdate\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046\u5834\u5408\u3002<\/p>\n<div>\n<div style=\"height: 15px;\"><span style=\"background: #91D8AC; padding: 10px 10px; border-radius: 10px; color: #ffffff; font-weight: bold; margin-left: 10px;\">update\u30e1\u30bd\u30c3\u30c9<\/span><\/div>\n<div style=\"padding: 30px 15px 10px; border-radius: 5px; border: 8px solid #91D8AC;\">\n<p><strong>dict\u540d.update(\u8ffd\u52a0\u3059\u308bdict\u540d)<\/strong><\/p>\n<\/div>\n<\/div>\n<p>update\u306f\u3001\u8ffd\u52a0\u3082\u3067\u304d\u307e\u3059\u304c\u3001\u91cd\u8907\u3059\u308b\u30c7\u30fc\u30bf\u306f\u4e0a\u66f8\u304d\u3057\u307e\u3059\u3002<\/p>\n<h5><span class=\"ez-toc-section\" id=\"%E9%87%8D%E8%A4%87%E3%81%8C%E3%81%AA%E3%81%8F%E3%80%81%E3%83%87%E3%83%BC%E3%82%BF%E3%81%8C%E8%BF%BD%E5%8A%A0%E3%81%95%E3%82%8C%E3%82%8B%E5%A0%B4%E5%90%88\"><\/span>\u91cd\u8907\u304c\u306a\u304f\u3001\u30c7\u30fc\u30bf\u304c\u8ffd\u52a0\u3055\u308c\u308b\u5834\u5408<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\">employee = {'id': '1234', 'name': '\u9234\u6728'}\r\nadd_data = {'department': '\u55b6\u696d', 'position': '\u4fc2\u9577'}\r\nemployee.update(add_data)\r\nprint(employee)<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">{'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d', 'position': '\u4fc2\u9577'}<\/pre>\n<p>employee\u306badd_data\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3059\u3002<\/p>\n<h5><span class=\"ez-toc-section\" id=\"department%E3%81%8C%E9%87%8D%E8%A4%87%E3%81%97%E3%81%A6%E3%81%84%E3%82%8B%E5%A0%B4%E5%90%88\"><\/span>department\u304c\u91cd\u8907\u3057\u3066\u3044\u308b\u5834\u5408<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\"># \u91cd\u8907\u304c\u3042\u308b\u5834\u5408\r\nemployee = {'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}\r\nadd_data = {'department': '\u958b\u767a', 'position': '\u4fc2\u9577'}\r\nemployee.update(add_data)\r\nprint(employee)<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">{'id': '1234', 'name': '\u9234\u6728', 'department': '\u958b\u767a', 'position': '\u4fc2\u9577'}<\/pre>\n<p>\u91cd\u8907\u5206\u306f\u4e0a\u66f8\u304d\u3055\u308c\u307e\u3059\u3002<\/p>\n<h4><span class=\"ez-toc-section\" id=\"dict%E3%83%A1%E3%82%BD%E3%83%83%E3%83%89\"><\/span>dict\u30e1\u30bd\u30c3\u30c9<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>2\u3064\u76ee\u306f\u7d44\u307f\u8fbc\u307f\u95a2\u6570\u306edict\u3092\u4f7f\u3046\u5834\u5408\u3002<\/p>\n<p>dict\u306b**\u3092\u3064\u3051\u3066\u3001\u30c7\u30fc\u30bf\u3092\u4e0e\u3048\u307e\u3059\u3002<\/p>\n<div>\n<div style=\"height: 15px;\"><span style=\"background: #91D8AC; padding: 10px 10px; border-radius: 10px; color: #ffffff; font-weight: bold; margin-left: 10px;\">\u7d44\u307f\u8fbc\u307f\u95a2\u6570\u306edict\u3092\u4f7f\u3046\u5834\u5408<\/span><\/div>\n<div style=\"padding: 30px 15px 10px; border-radius: 5px; border: 8px solid #91D8AC;\">\n<p><strong>\u65b0\u3057\u3044dict\u540d <span style=\"color: #800080;\">=<\/span> dict(<span style=\"color: #800080;\">**<\/span>dict\u540d, <span style=\"color: #800080;\">**<\/span>dict\u540d)<\/strong><\/p>\n<\/div>\n<\/div>\n<p>\u7d50\u5408\u3055\u308c\u305f\u30c7\u30fc\u30bf\u306f\u65b0\u3057\u3044dict\u540d\u3067\u5165\u308c\u3066\u3042\u3052\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\"># dict\u3092\u4f7f\u3046\u5834\u5408\r\ndata1 = {'id': '1234', 'name': '\u9234\u6728'}\r\ndata2 = {'department': '\u55b6\u696d', 'position': '\u4fc2\u9577'}\r\nemployee = dict(**data1, **data2)\r\nprint(employee)<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">{'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d', 'position': '\u4fc2\u9577'}<\/pre>\n<p>\u3053\u306e\u65b9\u6cd5\u306f\u3001\u91cd\u8907\u3057\u305f\u30ad\u30fc\u304c\u3042\u308b\u3068\u30a8\u30e9\u30fc\u304c\u51fa\u307e\u3059\u3002<\/p>\n<p>\u8a66\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E5%89%8A%E9%99%A4%E3%81%99%E3%82%8B%E3%83%A1%E3%82%BD%E3%83%83%E3%83%89%E3%81%AF4%E7%A8%AE%E9%A1%9E\"><\/span>\u524a\u9664\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u306f4\u7a2e\u985e<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u524a\u9664\u3059\u308b\u65b9\u6cd5\u306f4\u3064\u3042\u308a\u307e\u3059\u3002<\/p>\n<table style=\"border-collapse: collapse; width: 69.32314410480349%; height: 144px;\">\n<tbody>\n<tr>\n<td style=\"width: 50%; background-color: #858585; text-align: center;\"><strong><span style=\"color: #000000;\">\u30e1\u30bd\u30c3\u30c9 \/ \u6587<\/span><\/strong><\/td>\n<td style=\"width: 50%; background-color: #858585; text-align: center;\"><strong><span style=\"color: #000000;\">\u6a5f\u80fd<\/span><\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\">clear \u82e5\u3057\u304f\u306f {}<\/td>\n<td style=\"width: 50%;\">\u5168\u524a\u9664<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\">pop(\u30ad\u30fc\u5024)<\/td>\n<td style=\"width: 50%;\">\u6307\u5b9a\u3057\u305f\u30ad\u30fc\u306e\u5024\u3092\u53d6\u308a\u51fa\u3059<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\">popitem()<\/td>\n<td style=\"width: 50%;\">\u672b\u5c3e\u306e\u30ad\u30fc\u3001\u30c7\u30fc\u30bf\u3092\u53d6\u5f97<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\">del dict\u540d[\u30ad\u30fc]<\/td>\n<td style=\"width: 50%;\">\u6307\u5b9a\u3057\u305f\u30c7\u30fc\u30bf\u3092\u524a\u9664<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u540c\u69d8\u306bemployee\u30c7\u30fc\u30bf\u3067\u898b\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h4><span class=\"ez-toc-section\" id=\"clear%E5%85%A8%E5%89%8A%E9%99%A4%E3%83%A1%E3%82%BD%E3%83%83%E3%83%89\"><\/span>clear(\u5168\u524a\u9664)\u30e1\u30bd\u30c3\u30c9<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u5168\u524a\u9664\u306f\u3001\u30c7\u30fc\u30bf\u8aad\u307f\u76f4\u3057\u3084\u521d\u671f\u5316\u3067\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\"># \u5168\u524a\u9664\u3000clear\r\nemployee = {'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}\r\nprint(\"\u524a\u9664\u524d\", employee)\r\nemployee.clear()\r\nprint(\"\u524a\u9664\u5f8c\", employee)<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">\u524a\u9664\u524d {'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}\r\n\u524a\u9664\u5f8c {}<\/pre>\n<p>= {}\u3092\u4f7f\u3046\u65b9\u6cd5\u3082\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\"># \u5168\u524a\u9664\u3000{}\r\nemployee = {'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}\r\nprint(\"\u524a\u9664\u524d\", employee)\r\nemployee = {}\r\nprint(\"\u524a\u9664\u5f8c\", employee)<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">\u524a\u9664\u524d {'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}\r\n\u524a\u9664\u5f8c {}<\/pre>\n<h4><span class=\"ez-toc-section\" id=\"pop%E3%83%A1%E3%82%BD%E3%83%83%E3%83%89\"><\/span>pop\u30e1\u30bd\u30c3\u30c9<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>pop(\u30ad\u30fc)\u3067\u306flist\u3068\u540c\u3058\u3067\u3001\u30c7\u30fc\u30bf\u3092\u53d6\u308a\u51fa\u3057\u307e\u3059\u3002<\/p>\n<p>\u53d6\u308a\u51fa\u3057\u306a\u306e\u3067\u3001\u53d6\u308a\u51fa\u3057\u305f\u5206\u304c\u524a\u9664\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>id\u306e\u30c7\u30fc\u30bf\u3092pop\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\"># pop\r\nemployee = {'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}\r\nprint(\"pop\u524d\", employee)\r\nd = employee.pop('id')\r\nprint(\"pop\u30c7\u30fc\u30bf\", d)\r\nprint(\"pop\u5f8c\", employee)<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">pop\u524d {'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}\r\npop\u30c7\u30fc\u30bf 1234\r\npop\u5f8c {'name': '\u9234\u6728', 'department': '\u55b6\u696d'}<\/pre>\n<h4><span class=\"ez-toc-section\" id=\"popitem%E3%83%A1%E3%82%BD%E3%83%83%E3%83%89\"><\/span>popitem\u30e1\u30bd\u30c3\u30c9<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>popitem\u306fpop\u3068\u540c\u3058\u3067\u53d6\u308a\u51fa\u3057\u307e\u3059\u3002<\/p>\n<p>popitem\u306f\u672b\u5c3e\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u308a\u51fa\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\"># popitem\r\nemployee = {'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}\r\nprint(\"popitem\u524d\", employee)\r\nk, d = employee.popitem()\r\nprint(\"popitem\u30c7\u30fc\u30bf\", k, d)\r\nprint(\"popitem\u5f8c\", employee)<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">popitem\u524d {'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}\r\npopitem\u30c7\u30fc\u30bf department \u55b6\u696d\r\npopitem\u5f8c {'id': '1234', 'name': '\u9234\u6728'}<\/pre>\n<h4><span class=\"ez-toc-section\" id=\"del\"><\/span>del<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>del \u3067\u306f\u6307\u5b9a\u3057\u305f\u30c7\u30fc\u30bf\u3092\u524a\u9664\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>del dict\u30c7\u30fc\u30bf[\u30ad\u30fc]\u3068\u3059\u308b\u3053\u3068\u3067\u3001\u524a\u9664\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<div>\n<div style=\"height: 15px;\"><span style=\"background: #91D8AC; padding: 10px 10px; border-radius: 10px; color: #ffffff; font-weight: bold; margin-left: 10px;\">\u6ce8\u610f\u30dd\u30a4\u30f3\u30c8<\/span><\/div>\n<div style=\"padding: 30px 15px 10px; border-radius: 5px; border: 8px solid #91D8AC;\">\n<p>\u30e1\u30bd\u30c3\u30c9\u3067\u306f\u306a\u3044\u306e\u3067\u3001\u304b\u3063\u3053\u4e0d\u8981\u3067\u3059\u3002<\/p>\n<p>del(dict\u30c7\u30fc\u30bf[\u30ad\u30fc])\u3067\u306f\u306a\u3044\u306e\u3067\u3054\u6ce8\u610f\u304f\u3060\u3055\u3044\u3002<\/p>\n<\/div>\n<\/div>\n<p>\u3067\u306f\u3001\u30b3\u30fc\u30c9\u3067\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\"># del\r\nemployee = {'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}\r\nprint(\"del\u524d\", employee)\r\ndel employee['id']\r\nprint(\"del\u5f8c\", employee)<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">del\u524d {'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}\r\ndel\u5f8c {'name': '\u9234\u6728', 'department': '\u55b6\u696d'}<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"dict%E8%BE%9E%E6%9B%B8%E3%81%AE%E5%BF%9C%E7%94%A8\"><\/span>dict(\u8f9e\u66f8)\u306e\u5fdc\u7528<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u3055\u3066\u3001\u3053\u3053\u304b\u3089\u3055\u3089\u306b\u4f7f\u3044\u3053\u306a\u305b\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"for%E6%96%87%E3%81%A7%E4%BD%BF%E3%81%86\"><\/span>for\u6587\u3067\u4f7f\u3046<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u8f9e\u66f8\u3068\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306f\u3088\u304f\u4f7f\u3046\u306e\u3067\u3001\u3057\u3063\u304b\u308a\u7fd2\u5f97\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>dict\u30c7\u30fc\u30bf\u3092\u305d\u306e\u307e\u307e\u4f7f\u3063\u305f\u5834\u5408\u306f\u3001key\u5024\u304c\u53d6\u308a\u51fa\u305b\u307e\u3059\u3002<\/p>\n<p>\u53d6\u308a\u51fa\u3057\u305f\u30ad\u30fc\u5024\u3092\u4f7f\u3063\u3066\u3001employee\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\">employee = {'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}\r\nfor key in employee:\r\n    print(key, employee[key])<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">id 1234\r\nname \u9234\u6728\r\ndepartment \u55b6\u696d<\/pre>\n<p>items()\u3092\u4f7f\u3063\u305f\u7e70\u308a\u8fd4\u3057\u3067\u306f\u3001\u30ad\u30fc\u5024\u3068\u30c7\u30fc\u30bf\u304c\u53d6\u308a\u51fa\u305b\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\">employee = {'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}\r\nfor key, data in employee.items():\r\n    print(key, data)<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">id 1234\r\nname \u9234\u6728\r\ndepartment \u55b6\u696d<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"%E5%85%A5%E3%82%8C%E5%AD%90%E6%A7%8B%E9%80%A0%E3%81%AE%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AB%E3%81%99%E3%82%8B\"><\/span>\u5165\u308c\u5b50\u69cb\u9020\u306e\u30c7\u30fc\u30bf\u306b\u3059\u308b<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u57fa\u790e\u306e\u3068\u3053\u308d\u3067\u306f\u3001\u4e0b\u8a18\u306e\u30c7\u30fc\u30bf\u30921\u884c\u305a\u3064dict\u30c7\u30fc\u30bf\u306b\u3057\u3066\u3001\u914d\u5217\u306b\u5165\u308c\u307e\u3057\u305f\u3002<\/p>\n<table style=\"border-collapse: collapse; width: 70.85152838427948%; height: 75px;\">\n<tbody>\n<tr>\n<td style=\"width: 33.333333333333336%; background-color: #424242; text-align: center;\"><span style=\"color: #ffffff;\"><strong>ID<\/strong><\/span><\/td>\n<td style=\"width: 33.333333333333336%; background-color: #424242; text-align: center;\"><span style=\"color: #ffffff;\"><strong>\u540d\u524d<\/strong><\/span><\/td>\n<td style=\"width: 33.333333333333336%; background-color: #424242; text-align: center;\"><span style=\"color: #ffffff;\"><strong>\u90e8\u9580<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.333333333333336%;\">1234<\/td>\n<td style=\"width: 33.333333333333336%;\">\u9234\u6728<\/td>\n<td style=\"width: 33.333333333333336%;\">\u55b6\u696d<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.333333333333336%;\">1222<\/td>\n<td style=\"width: 33.333333333333336%;\">\u4f50\u85e4<\/td>\n<td style=\"width: 33.333333333333336%;\">\u7dcf\u52d9<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>\u3053\u308c\u306f\u3001dict\u3092\u5165\u308c\u5b50\u306b\u3057\u3066\u4f5c\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>id\u306e\u5024\u3092\u30ad\u30fc\u306b\u3057\u3066\u3001\u5165\u308c\u5b50\u69cb\u9020\u306b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\">employee1 = {\r\n    'name': '\u9234\u6728',\r\n    'department': '\u55b6\u696d',\r\n}\r\nemployee2 = {\r\n    'name': '\u4f50\u85e4',\r\n    'department': '\u7dcf\u52d9',\r\n}\r\n# id\u3092\u30ad\u30fc\u306b\u3057\u3066dict\u3092\u5165\u308c\u5b50\u69cb\u9020\r\nemployee = {\r\n    '1234': employee1,\r\n    '1222': employee2\r\n}\r\nprint(employee)\r\nprint('1234\u306e\u30c7\u30fc\u30bf', employee['1234'])<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">{'1234': {'name': '\u9234\u6728', 'department': '\u55b6\u696d'}, '1222': {'name': '\u4f50\u85e4', 'department': '\u7dcf\u52d9'}}\r\n1234\u306e\u30c7\u30fc\u30bf {'name': '\u9234\u6728', 'department': '\u55b6\u696d'}<\/pre>\n<p>\u3053\u306e\u65b9\u6cd5\u3084\u914d\u5217\u306b\u3059\u308b\u65b9\u6cd5\u3001\u3069\u308c\u304c\u6b63\u3057\u3044\u3068\u3044\u3046\u306e\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u308f\u304b\u308a\u3084\u3059\u3044\u65b9\u6cd5\u3092\u4f7f\u7528\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E3%82%AD%E3%83%BC%E3%81%AE%E6%9C%89%E7%84%A1%E3%81%AFin%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6%E7%A2%BA%E8%AA%8D\"><\/span>\u30ad\u30fc\u306e\u6709\u7121\u306fin\u3092\u4f7f\u3063\u3066\u78ba\u8a8d<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u30ad\u30fc\u5024\u304c\u3042\u308b\u304b\u3069\u3046\u304b\u306e\u78ba\u8a8d\u306f\u3088\u304f\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<p>\u30ad\u30fc\u5024\u304c\u306a\u3051\u308c\u3070\u3001\u30a8\u30e9\u30fc\u3068\u306a\u308b\u51e6\u7406\u3082\u3042\u308b\u305f\u3081\u3067\u3059\u3002<\/p>\n<p>\u30ad\u30fc\u306e\u6709\u7121\u306f\u3001keys\u3067\u53d6\u5f97\u3067\u304d\u308bkey\u5024\u306e\u30c7\u30fc\u30bf\u306b\u5bfe\u3057\u3066\u3001in\u3092\u4f7f\u3063\u3066\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<div>\n<div style=\"height: 15px;\"><span style=\"background: #91D8AC; padding: 10px 10px; border-radius: 10px; color: #ffffff; font-weight: bold; margin-left: 10px;\">\u30ad\u30fc\u5024\u306e\u6709\u7121\u78ba\u8a8d<\/span><\/div>\n<div style=\"padding: 30px 15px 10px; border-radius: 5px; border: 8px solid #91D8AC;\">\n<p><strong><span style=\"color: #008000;\">\u78ba\u8a8d\u3057\u305f\u3044\u30ad\u30fc\u5024<\/span> <span style=\"color: #ff6600;\">in<\/span> dict.<span style=\"color: #0000ff;\">keys<\/span>()<\/strong><\/p>\n<\/div>\n<\/div>\n<p>\u3068\u3057\u307e\u3059\u3002\u540c\u69d8\u306b\u3001values\u3067\u5024\u306e\u5b58\u5728\u78ba\u8a8d\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\">employee = {'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}\r\nprint('id\u6709\u7121', 'id' in employee.keys())\r\n\r\nemployee = {'id': '1234', 'name': '\u9234\u6728', 'department': '\u55b6\u696d'}\r\nprint('position\u6709\u7121', 'position' in employee.keys())<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">id\u6709\u7121 True\r\nposition\u6709\u7121 False<\/pre>\n<p>if\u6587\u3068\u4e00\u7dd2\u306b\u7d44\u307f\u308f\u305b\u3066\u4f7f\u3046\u3053\u3068\u304c\u591a\u3044\u3067\u3059\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E4%B8%A6%E3%81%B9%E6%9B%BF%E3%81%88%E3%81%AB%E3%81%AFsorted%E3%82%92%E4%BD%BF%E3%81%86\"><\/span>\u4e26\u3079\u66ff\u3048\u306b\u306fsorted\u3092\u4f7f\u3046<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>dict\u306e\u4e26\u3079\u66ff\u3048\u306f\u3001\u30ad\u30fc\u5024\u3068\u30c7\u30fc\u30bf\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u305d\u308c\u305e\u308c\u4e26\u3079\u66ff\u3048\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4e26\u3073\u66ff\u3048\u306b\u306f<a href=\"https:\/\/docs.python.org\/ja\/3\/howto\/sorting.html\" target=\"_blank\" rel=\"noopener\">sorted<\/a>\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<p>sorted\u306bdict\u30c7\u30fc\u30bf.items()\u3067\u30ad\u30fc\u5024\u3068\u30c7\u30fc\u30bf\u3092\u6e21\u3057\u3066\u3001reverse\u3067\u6607\u9806\uff08False\uff09\u3068\u964d\u9806\uff08True\uff09\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<div>\n<div style=\"height: 15px;\"><span style=\"background: #91D8AC; padding: 10px 10px; border-radius: 10px; color: #ffffff; font-weight: bold; margin-left: 10px;\">\u4e26\u3073\u66ff\u3048<\/span><\/div>\n<div style=\"padding: 30px 15px 10px; border-radius: 5px; border: 8px solid #91D8AC;\">\n<p><b><span style=\"color: #008000;\">sorted<\/span>(dict\u30c7\u30fc\u30bf.<span style=\"color: #0000ff;\">items<\/span>(), reverse<span style=\"color: #800080;\">=<\/span><span style=\"color: #008000;\">True<\/span>\/<span style=\"color: #008000;\">False<\/span>)<\/b><\/p>\n<\/div>\n<\/div>\n<p>\u307e\u305a\u3001\u30ad\u30fc\u5024\u306e\u4e26\u3079\u66ff\u3048\u3092\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u4e26\u3073\u66ff\u3048\u304c\u308f\u304b\u308a\u3084\u3059\u3044\u3088\u3046\u306b\u30c7\u30fc\u30bf\u3092\uff08{&#8216;\u9234\u6728&#8217;: 90, &#8216;\u4f50\u85e4&#8217;: 70, &#8216;\u7530\u4e2d&#8217;: 80}\uff09\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\"># \u30ad\u30fc\u3092\u6607\u9806\r\nemployee = {'\u3059\u305a\u304d': 90, '\u3055\u3068\u3046': 70, '\u305f\u306a\u304b': 80}\r\nemployee_sorted = sorted(employee.items(), reverse=False)\r\nprint('\u6607\u9806', employee_sorted)\r\n\r\n# \u30ad\u30fc\u3092\u964d\u9806\r\nemployee = {'\u3059\u305a\u304d': 90, '\u3055\u3068\u3046': 70, '\u305f\u306a\u304b': 80}\r\nemployee_sorted = sorted(employee.items(), reverse=True)\r\nprint('\u964d\u9806', employee_sorted)<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">\u6607\u9806 [('\u3055\u3068\u3046', 70), ('\u3059\u305a\u304d', 90), ('\u305f\u306a\u304b', 80)]\r\n\u964d\u9806 [('\u305f\u306a\u304b', 80), ('\u3059\u305a\u304d', 90), ('\u3055\u3068\u3046', 70)]<\/pre>\n<p>\u6b21\u306f\u3001\u30c7\u30fc\u30bf\u306e\u65b9\u3092\u4e26\u3073\u66ff\u3048\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u3001sorted\u306b\u6e21\u3057\u3066\u308b\u3001employee.items()\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\">employee.items()<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">dict_items([('\u3059\u305a\u304d', 90), ('\u3055\u3068\u3046', 70), ('\u305f\u306a\u304b', 80)])<\/pre>\n<p>\u30ad\u30fc\u5024,\u30c7\u30fc\u30bf\u304c\u4e26\u3093\u3067\u304a\u308a\u30012\u5217\u76ee\u306e\u30c7\u30fc\u30bf\u3092\u4e26\u3073\u66ff\u3048\u305f\u3044\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e2\u5217\u76ee\u306e\u6307\u5b9a\u306f\u3001\u7121\u540d\u95a2\u6570(lambda)\u3092\u4f7f\u3046\u3068\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>sorted\u306e\u5f15\u6570\u306bkey=lambda e: e[<strong>\u5217\u756a\u53f7<\/strong>]\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<div>\n<div style=\"height: 15px;\"><span style=\"background: #91D8AC; padding: 10px 10px; border-radius: 10px; color: #ffffff; font-weight: bold; margin-left: 10px;\">\u4e26\u3073\u66ff\u3048<\/span><\/div>\n<div style=\"padding: 30px 15px 10px; border-radius: 5px; border: 8px solid #91D8AC;\">\n<p><b><span style=\"color: #008000;\">sorted<\/span>(dict\u30c7\u30fc\u30bf.<span style=\"color: #0000ff;\">items<\/span>(), reverse<span style=\"color: #800080;\">=<\/span><span style=\"color: #008000;\">True<\/span>\/<span style=\"color: #008000;\">False,\u00a0<span style=\"color: #000000;\">key<span style=\"color: #800080;\">=<\/span><span style=\"color: #008000;\">lambda<\/span> e: e[<strong>\u5217\u756a\u53f7<\/strong>]<\/span><\/span>)<\/b><\/p>\n<\/div>\n<\/div>\n<p>\u5217\u756a\u53f7\u306f0\u304b\u3089\u59cb\u307e\u308b\u756a\u53f7\u3067\u3059\u3002\u4eca\u56de\u306f2\u5217\u76ee\u306a\u306e\u3067\u5217\u756a\u53f7=1\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" title=\"In\"># \u30ad\u30fc\u3092\u6607\u9806\r\nemployee = {'\u3059\u305a\u304d': 90, '\u3055\u3068\u3046': 70, '\u305f\u306a\u304b': 80}\r\nemployee_sorted = sorted(employee.items(), reverse=False, key=lambda e: e[1])\r\nprint('\u6607\u9806', employee_sorted)\r\n\r\n# \u30ad\u30fc\u3092\u964d\u9806\r\nemployee = {'\u3059\u305a\u304d': 90, '\u3055\u3068\u3046': 70, '\u305f\u306a\u304b': 80}\r\nemployee_sorted = sorted(employee.items(), reverse=True, key=lambda e: e[1])\r\nprint('\u964d\u9806', employee_sorted)<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" title=\"Out\">\u6607\u9806 [('\u3055\u3068\u3046', 70), ('\u305f\u306a\u304b', 80), ('\u3059\u305a\u304d', 90)]\r\n\u964d\u9806 [('\u3059\u305a\u304d', 90), ('\u305f\u306a\u304b', 80), ('\u3055\u3068\u3046', 70)]<\/pre>\n<p>\u7121\u540d\u95a2\u6570\u306f\u3001\u95a2\u6570\u306e\u4e00\u7a2e\u3067\u3059\u3002<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u306f\u3001\u3053\u306e\u4e26\u3079\u66ff\u3048\u3082\u6c7a\u307e\u308a\u6587\u53e5\u306e\u3088\u3046\u306a\u3082\u306e\u3067\u3059\u306e\u3067\u3001\u3053\u3046\u3044\u3046\u3082\u306e\u3060\u3068\u7406\u89e3\u3057\u3066\u304a\u3051\u3070OK\u3067\u3059\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E3%81%BE%E3%81%A8%E3%82%81\"><\/span>\u307e\u3068\u3081<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306fdict\u306e\u4f7f\u3044\u65b9\u306e\u57fa\u790e\u3068\u5fdc\u7528\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3088\u304f\u4f7f\u3044\u307e\u3059\u306e\u3067\u3001\u3057\u3063\u304b\u308a\u7406\u89e3\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u56de\u306f\u914d\u5217\u3068\u540c\u3058\u3088\u3046\u306a\u3001\u30c7\u30fc\u30bf\u306e\u96c6\u307e\u308a\u3067\u3042\u308bdict(\u8f9e\u66f8)\u306b\u3064\u3044\u3066\u7fd2\u5f97\u3057\u3066\u3044\u304d\u307e\u3059\u3002 \u914d\u5217\u306f\u3001\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3068\u304d\u306b\u306f\u3001index(\u914d\u5217\u756a\u53f7)\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002 dict\u306e\u8f9e\u66f8\u578b\u306f\u8f9e\u66f8\u3068\u547c\u3070\u308c\u308b\u901a\u308a\u3001\u7d22\u5f15\u304b\u3089\u30c7\u30fc &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/tetsumag.com\/blog\/2022\/01\/04\/97\/\"> <span class=\"screen-reader-text\">\u3010Python\u3011dict\u306e\u4f7f\u3044\u65b9<\/span> \u3082\u3063\u3068\u8aad\u3080 &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":14086,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","_themeisle_gutenberg_block_has_review":false},"categories":[127],"tags":[95,108],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/tetsumag.com\/blog\/wp-json\/wp\/v2\/posts\/5342"}],"collection":[{"href":"https:\/\/tetsumag.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tetsumag.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tetsumag.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tetsumag.com\/blog\/wp-json\/wp\/v2\/comments?post=5342"}],"version-history":[{"count":8,"href":"https:\/\/tetsumag.com\/blog\/wp-json\/wp\/v2\/posts\/5342\/revisions"}],"predecessor-version":[{"id":14090,"href":"https:\/\/tetsumag.com\/blog\/wp-json\/wp\/v2\/posts\/5342\/revisions\/14090"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tetsumag.com\/blog\/wp-json\/wp\/v2\/media\/14086"}],"wp:attachment":[{"href":"https:\/\/tetsumag.com\/blog\/wp-json\/wp\/v2\/media?parent=5342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tetsumag.com\/blog\/wp-json\/wp\/v2\/categories?post=5342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tetsumag.com\/blog\/wp-json\/wp\/v2\/tags?post=5342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}