{"id":1284,"date":"2018-10-15T09:08:57","date_gmt":"2018-10-15T00:08:57","guid":{"rendered":"https:\/\/python-introduction.com\/?p=1284"},"modified":"2018-10-15T09:08:58","modified_gmt":"2018-10-15T00:08:58","slug":"%e3%80%90python%e5%85%a5%e9%96%80%e3%80%91%e8%be%9e%e6%9b%b8%e3%82%92for%e3%83%ab%e3%83%bc%e3%83%97%e3%81%a7%e5%87%a6%e7%90%86%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/python-introduction.com\/?p=1284","title":{"rendered":"\u3010Python\u5165\u9580\u3011\u8f9e\u66f8\u3092for\u30eb\u30fc\u30d7\u3067\u51e6\u7406\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u8f9e\u66f8\u3092for\u30eb\u30fc\u30d7\u3067\u51e6\u7406\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066<br \/>\n\u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u524d\u306b\u3082\u3057\u8f9e\u66f8\u3068\u306f\uff1f\u3068\u304bfor\u6587\u3068\u306f\uff1f\u3064\u3044\u3066<br \/>\n\u3082\u3046\u5c11\u3057\u8a73\u3057\u304f\u77e5\u308a\u305f\u3044\u65b9\u306f\u3053\u3061\u3089\u306e\u8a18\u4e8b\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<br \/>\n\u21d2<a href=\"https:\/\/python-introduction.com\/?p=447#Python7dict\" target=\"blank\">\u8f9e\u66f8\u3068\u306f\uff1f<\/a><br \/>\n\u21d2<a href=\"https:\/\/python-introduction.com\/?p=768\" target=\"blank\">\u3010Python\u3011for\u6587\u306e\u66f8\u304d\u65b9\u3092\u8ab0\u3067\u3082\u308f\u304b\u308b\u3088\u3046\u306b\u89e3\u8aac<\/a><\/p>\n<p>\u305d\u308c\u3067\u306f\u672c\u984c\u306b\u5165\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">\u76ee\u6b21<\/p><ul class=\"toc_list\"><li><a href=\"#Pythonforkey\"><span class=\"toc_number toc_depth_1\">1<\/span> \u3010Python\u3011\u8f9e\u66f8\u3092for\u30eb\u30fc\u30d7\u3067key\u3060\u3051\u8868\u793a\u3055\u305b\u308b\u65b9\u6cd5<\/a><\/li><li><a href=\"#Pythonforvalue\"><span class=\"toc_number toc_depth_1\">2<\/span> \u3010Python\u3011\u8f9e\u66f8\u3092for\u30eb\u30fc\u30d7\u3067value\u3082\u8868\u793a\u3055\u305b\u308b\u65b9\u6cd5<\/a><\/li><li><a href=\"#Pythonitems\"><span class=\"toc_number toc_depth_1\">3<\/span> \u3010Python\u3011\u8f9e\u66f8\u306b\u3042\u308bitems()\u30e1\u30bd\u30c3\u30c9\u306b\u3064\u3044\u3066<\/a><\/li><\/ul><\/div>\n<h2><span id=\"Pythonforkey\">\u3010Python\u3011\u8f9e\u66f8\u3092for\u30eb\u30fc\u30d7\u3067key\u3060\u3051\u8868\u793a\u3055\u305b\u308b\u65b9\u6cd5<\/span><\/h2>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/python-introduction.com\/wp-content\/uploads\/2018\/10\/pasokontobasan1014.jpg\" alt=\"python \u8f9e\u66f8 for\" width=\"620\" height=\"341\" class=\"alignnone size-full wp-image-1286\" srcset=\"https:\/\/python-introduction.com\/wp-content\/uploads\/2018\/10\/pasokontobasan1014.jpg 620w, https:\/\/python-introduction.com\/wp-content\/uploads\/2018\/10\/pasokontobasan1014-300x165.jpg 300w\" sizes=\"(max-width: 620px) 100vw, 620px\" \/><\/p>\n<p>\u307e\u305a\u4f8b\u984c1\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">#\u4f8b\u984c1\r\n\r\na = {'ppp': 15, 'qqq': 40}\r\nfor b in a:\r\n    print(b)<\/pre>\n<p>\u4f8b\u984c1\u306e\u3088\u3046\u306b&#8217;ppp&#8217;: 15, &#8216;qqq&#8217;: 40\u3068\u3044\u3046\u60c5\u5831\u304c\u5165\u3063\u305f\u8f9e\u66f8\u3092<br \/>\n\u5909\u6570a\u306b\u4ee3\u5165\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3067\u3001\u5909\u6570a\u306e\u8f9e\u66f8\u5185\u5bb9\u3092for\u30eb\u30fc\u30d7\u3067\u307e\u308f\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u5b9f\u884c\u3059\u308b\u3068<\/p>\n<div class=\"boxstyle01\">ppp<br \/>\nqqq<\/div>\n<p>\u3068\u3044\u3046\u7d50\u679c\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u4f8b\u984c1\u3067<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">a = {'ppp': 15, 'qqq': 40}<\/pre>\n<p>\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001ppp\u3084qqq\u3092key\u3068\u3044\u3044\u3001<br \/>\n15\u308440\u3092value\u3068\u3044\u3044\u307e\u3059\u3002<\/p>\n<p><span class=\"redb16\">\u4f8b\u984c1\u306e\u8a18\u8ff0\u3067\u306f\u5b9f\u884c\u3057\u3066\u3082key\u3060\u3051\u304c\u8868\u793a\u3055\u308c<br \/>\nvalue\u306f\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002<\/span><\/p>\n<p>\u3067\u306f\u3069\u3046\u3059\u308c\u3070value\u3082\u8868\u793a\u3055\u305b\u308b\u3053\u3068\u304c<br \/>\n\u3067\u304d\u308b\u306e\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<h2><span id=\"Pythonforvalue\">\u3010Python\u3011\u8f9e\u66f8\u3092for\u30eb\u30fc\u30d7\u3067value\u3082\u8868\u793a\u3055\u305b\u308b\u65b9\u6cd5<\/span><\/h2>\n<p><span class=\"yellowbg\">\u8f9e\u66f8\u306b\u306f\u30e1\u30bd\u30c3\u30c9\u3068\u3057\u3066items()\u304c\u3042\u308a\u307e\u3059\u3002<\/span><br \/>\nitems()\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046\u3053\u3068\u3067value\u306e\u5024\u3082\u8868\u793a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3067\u306fitems()\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3063\u305f\u4f8b\u984c2\u3092\u307f\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">#\u4f8b\u984c2\r\n\r\na = {'ppp': 15, 'qqq': 40}\r\nfor b, c in a.items():\r\n    print(b, c)<\/pre>\n<p>\u4f8b\u984c2\u306f<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">for b, c in a.items():<\/pre>\n<p>\u3068items()\u30e1\u30bd\u30c3\u30c9\u3092\u5229\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u306b\u3088\u308a\u3001ppp\u3068qqq\u3068\u3044\u3046key\u306fb\u306b\u5165\u308a<br \/>\n15\u306840\u3068\u3044\u3046value\u306fc\u306b\u5165\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">print(b, c)<\/pre>\n<p>\u306b\u3088\u3063\u3066\u3001b,c\u306b\u5165\u3063\u305fkey\u3068value\u304c\u305d\u308c\u305e\u308c<br \/>\n\u8868\u793a\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u984c2\u3092\u5b9f\u884c\u3059\u308b\u3068<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">ppp 15\r\nqqq 40<\/pre>\n<p>\u3068\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<h2><span id=\"Pythonitems\">\u3010Python\u3011\u8f9e\u66f8\u306b\u3042\u308bitems()\u30e1\u30bd\u30c3\u30c9\u306b\u3064\u3044\u3066<\/span><\/h2>\n<p>\u5148\u307b\u3069\u4f7f\u3063\u3066\u307f\u305fitems()\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u304c<br \/>\n\u4f55\u3092\u8fd4\u3057\u3066\u3044\u308b\u306e\u3067\u3057\u3087\u3046\uff1f<\/p>\n<p>\u4f8b\u984c3\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">#\u4f8b\u984c3\r\n\r\na = {'ppp': 15, 'qqq': 40}\r\nprint(a.items())<\/pre>\n<p>\u4f8b\u984c3\u3092\u5b9f\u884c\u3059\u308b\u3068<\/p>\n<div class=\"boxstyle01\">dict_items([(&#8216;ppp&#8217;, 15), (&#8216;qqq&#8217;, 40)])<\/div>\n<p>\u3068\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><span class=\"yellowbg\">\u3053\u306e\u3088\u3046\u306b\u30ea\u30b9\u30c8\u306e\u4e2d\u306b\u30bf\u30d7\u30eb\u306e\u5f62\u306b\u306a\u3063\u3066<br \/>\nkey\u3068value\u304c\u5165\u3063\u3066\u3044\u307e\u3059\u3002<\/span><\/p>\n<p>\u3061\u306a\u307f\u306b\u30bf\u30d7\u30eb\u306f()\u3067\u304f\u304f\u3089\u308c\u308b\u3082\u306e\u3092\u3044\u3063\u3066<br \/>\n\u30ea\u30b9\u30c8\u306f[]\u3067\u304f\u304f\u3089\u308c\u308b\u3082\u306e\u3092\u3044\u3044\u307e\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a(&#8216;ppp&#8217;, 15)\u3084(&#8216;qqq&#8217;, 40)\u306f\u30bf\u30d7\u30eb\u3067<br \/>\n[(&#8216;ppp&#8217;, 15), (&#8216;qqq&#8217;, 40)]\u306f\u30ea\u30b9\u30c8\u3067\u3059\u3002<\/p>\n<p>\u30ea\u30b9\u30c8\u3068\u30bf\u30d7\u30eb\u306f\u540c\u3058\u3088\u3046\u306b\u30ab\u30c3\u30b3\u3067\u304f\u304f\u3063\u3066\u3044\u307e\u3059\u3051\u3069<br \/>\n\u52b9\u679c\u30fb\u52b9\u80fd\u306f\u9055\u3044\u307e\u3059\u3002<\/p>\n<p>\u30bf\u30d7\u30eb\u3084\u30ea\u30b9\u30c8\u306b\u3064\u3044\u3066\u306f\u3053\u3061\u3089\u306e\u8a18\u4e8b\u3067\u8a73\u3057\u304f\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u21d2<a href=\"https:\/\/python-introduction.com\/?p=1073\" target=\"blank\">\u3010Python\u3011\u30bf\u30d7\u30eb\u3068\u306f\uff1f\u30ea\u30b9\u30c8\u3068\u30bf\u30d7\u30eb\u306e\u9055\u3044\u306b\u3064\u3044\u3066\u3082\u89e3\u8aac<\/a><br \/>\n\u21d2<a href=\"https:\/\/python-introduction.com\/?p=658\" target=\"blank\">\u3010Python\u3011\u30bf\u30d7\u30eb\u3092\u4f7f\u30463\u3064\u306e\u30e1\u30ea\u30c3\u30c8\u3068\u30ea\u30b9\u30c8\u3068\u306e\u9055\u3044<\/a><\/p>\n<p>\u4ee5\u4e0a\u3067\u89e3\u8aac\u3092\u7d42\u308f\u308a\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u3053\u306e\u8a18\u4e8b\u3067\u306f\u8f9e\u66f8\u3092for\u30eb\u30fc\u30d7\u3067\u51e6\u7406\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066 \u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u3002 \u305d\u306e\u524d\u306b\u3082\u3057\u8f9e\u66f8\u3068\u306f\uff1f\u3068\u304bfor\u6587\u3068\u306f\uff1f\u3064\u3044\u3066 \u3082\u3046\u5c11\u3057\u8a73\u3057\u304f\u77e5\u308a\u305f\u3044\u65b9\u306f\u3053\u3061\u3089\u306e\u8a18\u4e8b\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002 \u21d2\u8f9e\u66f8\u3068\u306f\uff1f \u21d2\u3010Python\u3011for\u6587\u306e [&hellip;]","protected":false},"author":1,"featured_media":1285,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[58,16,49],"tags":[64,3,50],"_links":{"self":[{"href":"https:\/\/python-introduction.com\/index.php?rest_route=\/wp\/v2\/posts\/1284"}],"collection":[{"href":"https:\/\/python-introduction.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/python-introduction.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/python-introduction.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/python-introduction.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1284"}],"version-history":[{"count":4,"href":"https:\/\/python-introduction.com\/index.php?rest_route=\/wp\/v2\/posts\/1284\/revisions"}],"predecessor-version":[{"id":1290,"href":"https:\/\/python-introduction.com\/index.php?rest_route=\/wp\/v2\/posts\/1284\/revisions\/1290"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/python-introduction.com\/index.php?rest_route=\/wp\/v2\/media\/1285"}],"wp:attachment":[{"href":"https:\/\/python-introduction.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1284"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/python-introduction.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1284"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/python-introduction.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}