{"id":1269,"date":"2018-10-14T11:34:34","date_gmt":"2018-10-14T02:34:34","guid":{"rendered":"https:\/\/python-introduction.com\/?p=1269"},"modified":"2018-10-14T11:34:34","modified_gmt":"2018-10-14T02:34:34","slug":"%e3%80%90python%e5%85%a5%e9%96%80%e3%80%91enumerate%e9%96%a2%e6%95%b0%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9","status":"publish","type":"post","link":"https:\/\/python-introduction.com\/?p=1269","title":{"rendered":"\u3010Python\u5165\u9580\u3011enumerate\u95a2\u6570\u306e\u4f7f\u3044\u65b9"},"content":{"rendered":"<p>\u3053\u306e\u8a18\u4e8b\u3067\u306fPython\u3067\u3088\u304f\u4f7f\u3046enumerate\u95a2\u6570\u306e\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u308f\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h2>\u3010Python\u3011enumerate\u95a2\u6570\u3092\u4f7f\u3046\u524d\u306b<\/h2>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/python-introduction.com\/wp-content\/uploads\/2018\/08\/psokondansei826.jpg\" alt=\"python enumerate\" width=\"620\" height=\"414\" class=\"alignnone size-full wp-image-1044\" srcset=\"https:\/\/python-introduction.com\/wp-content\/uploads\/2018\/08\/psokondansei826.jpg 620w, https:\/\/python-introduction.com\/wp-content\/uploads\/2018\/08\/psokondansei826-300x200.jpg 300w\" sizes=\"(max-width: 620px) 100vw, 620px\" \/><\/p>\n<p>enumerate\u95a2\u6570\u306e\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u7406\u89e3\u3059\u308b\u305f\u3081\u306b<br \/>\n\u307e\u305a\u3001for\u6587\u306e\u4f8b\u984c\u3092\u4e00\u7dd2\u306b\u3084\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">#\u4f8b\u984c1\r\n\r\nfor fish in ('\u30de\u30b0\u30ed', '\u30cf\u30de\u30c1', '\u30b5\u30f3\u30de'):\r\n    print(fish)<\/pre>\n<p>\u4f8b\u984c1\u3067\u306f\u5358\u7d14\u306bfor\u6587\u3092\u4f7f\u3044\u307e\u3057\u305f\u3002<br \/>\n\u5b9f\u884c\u3059\u308b\u3068\u3001<\/p>\n<div class=\"boxstyle01\">\u30de\u30b0\u30ed<br \/>\n\u30cf\u30de\u30c1<br \/>\n\u30b5\u30f3\u30de<\/div>\n<p>\u3068\u8868\u793a\u3055\u308c\u307e\u3059\u306d\u3002<\/p>\n<p>\u305f\u3068\u3048\u3070\u30de\u30b0\u30ed\u306e\u96a3\u306b\u9806\u756a\u3092\u8868\u3059\u6570\u5b57\u3092\u8868\u793a\u3055\u305b\u305f\u3044\u3068\u304d\u3063\u3066<br \/>\n\u3069\u3046\u3059\u308c\u3070\u3088\u3044\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<p>\u3053\u308c\u306f\u524d\u56de\u306e\u8a18\u4e8b\u3067\u89e3\u8aac\u3057\u307e\u3057\u305f\u306d\u3002<br \/>\n\u21d2<a href=\"https:\/\/python-introduction.com\/?p=1262\" target=\"blank\">\u8a73\u7d30\u306f\u3053\u3061\u3089<\/a><\/p>\n<p>\u307e\u3041\u3001\u3068\u308a\u3042\u3048\u305a\u4eca\u56de\u3082\u3084\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u304b\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">#\u4f8b\u984c2\r\n\r\ni = 0\r\nfor fish in ('\u30de\u30b0\u30ed', '\u30cf\u30de\u30c1', '\u30b5\u30f3\u30de'):\r\n    print(i, fish)<\/pre>\n<p>\u4f8b\u984c2\u3067\u306f<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">i = 0<\/pre>\n<p>\u3068\u3057\u3066\u3001<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\"> print(i, fish)<\/pre>\n<p>\u3068\u3059\u308b\u3053\u3068\u3067\u3001\u6570\u5b57\u304c\u30de\u30b0\u30ed\u3001\u30cf\u30de\u30c1\u3001\u30b5\u30f3\u30de\u306e\u5de6\u96a3\u306b<br \/>\n\u8868\u793a\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u5b9f\u884c\u3059\u308b\u3068<\/p>\n<div class=\"boxstyle01\">0 \u30de\u30b0\u30ed<br \/>\n0 \u30cf\u30de\u30c1<br \/>\n0 \u30b5\u30f3\u30de<\/div>\n<p>\u3068\u9b5a\u306e\u540d\u524d\u306e\u5de6\u96a3\u306b0\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u3001i = 0\u3060\u3051\u3060\u3068<br \/>\n\u9b5a\u306e\u540d\u524d\u306e\u5de6\u96a3\u306b\u306f\u3059\u3079\u30660\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f0,1,2\u30fb\u30fb\u30fb\u3068\u8868\u793a\u3055\u305b\u308b\u306b\u306f<br \/>\n\u3069\u3046\u3059\u308c\u3070\u3088\u3044\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\ni = 0\r\nfor fish in ('\u30de\u30b0\u30ed', '\u30cf\u30de\u30c1', '\u30b5\u30f3\u30de'):\r\n    print(i, fish)\r\n    i += 1<\/pre>\n<p>\u4f8b\u984c3\u3067\u306fprint\u6587\u306e\u6b21\u306b<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">i += 1<\/pre>\n<p>\u3092\u52a0\u3048\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u308c\u306b\u3088\u308a\u30010 \u30de\u30b0\u30ed\u3068\u8868\u793a\u3057\u305f\u5f8c<br \/>\n0\u306b1\u304c\u52a0\u3048\u3089\u308c1\u3068\u306a\u308a\u3001\u30cf\u30de\u30c1\u306e\u6a2a\u306b1\u304c\u8868\u793a\u3055\u308c<br \/>\n\u3055\u3089\u306b1\u306b1\u304c\u52a0\u3048\u3089\u308c\u30662\u3068\u306a\u308a\u3001\u30b5\u30f3\u30de\u306e\u6a2a\u306b\u8868\u793a\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u4f8b\u984c3\u3092\u5b9f\u884c\u3059\u308b\u3068<\/p>\n<div class=\"boxstyle01\">0 \u30de\u30b0\u30ed<br \/>\n1 \u30cf\u30de\u30c1<br \/>\n2 \u30b5\u30f3\u30de<\/div>\n<p>\u3068\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001i = 0<br \/>\n\u3068\u304b\u3001i += 1<br \/>\n\u3068\u304b\u8a18\u8ff0\u3059\u308b\u306e\u3063\u3066\u672c\u6c17\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u3084\u3063\u3066\u3044\u308b\u306a\u3089<br \/>\n\u9762\u5012\u304f\u3055\u3044\u3067\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u4f8b\u984c4\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2>\u3010Python\u3011enumerate\u95a2\u6570\u306e\u4f7f\u3044\u65b9<\/h2>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">#\u4f8b\u984c4\r\n\r\nfor i, fish in enumerate(['\u30de\u30b0\u30ed', '\u30cf\u30de\u30c1', '\u30b5\u30f3\u30de']):\r\n    print(i, fish)<\/pre>\n<p>\u5b9f\u884c\u3059\u308b\u3068<\/p>\n<div class=\"boxstyle01\">0 \u30de\u30b0\u30ed<br \/>\n1 \u30cf\u30de\u30c1<br \/>\n2 \u30b5\u30f3\u30de<\/div>\n<p>\u3068\u3001\u4f8b\u984c3\u3068\u540c\u3058\u7d50\u679c\u3092\u5f97\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u306d\u3002<\/p>\n<p>\u4f8b\u984c4\u3067\u306f<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">for i, fish in enumerate(['\u30de\u30b0\u30ed', '\u30cf\u30de\u30c1', '\u30b5\u30f3\u30de']):<\/pre>\n<p>\u3068\u8a18\u8ff0\u3057\u3066\u3044\u307e\u3059\u306d\u3002<\/p>\n<p>i, fish\u3068\u8a18\u8ff0\u3057\u3066\u3044\u308b\u3068\u3001<br \/>\nenumerate\u95a2\u6570\u304c\u521d\u3081\u306e\u30eb\u30fc\u30d7\u306e\u6642\u306bi\u306b0\u3092\u5165\u308c\u3066<br \/>\n\u3055\u3089\u306benumerate\u306e\u6700\u521d\u306e\u300e\u30de\u30b0\u30ed\u300f\u3092fish\u3068\u3044\u3046\u5909\u6570\u306b\u4ee3\u5165\u3057\u3066\u304f\u308c\u307e\u3059\u3002<br \/>\n\u5909\u6570\u306e\u4ee3\u5165\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=416\" target=\"blank\">\u3010Python\u5165\u9580\u3011\u5909\u6570\u306e\u4ee3\u5165\u306b\u3064\u3044\u3066\u308f\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac<\/a><\/p>\n<p>\u307e\u305f\u30011\u3092\u30cf\u30de\u30c1\u306b\u30012\u3092\u30b5\u30f3\u30de\u3068\u3057\u3066\u5bfe\u5fdc\u3055\u305b\u3066\u304f\u308c\u308b\u3093\u3067\u3059\u3002<\/p>\n<p>enumerate\u95a2\u6570\u306f\u9762\u5012\u306a\u51e6\u7406\u3092\u7c21\u5358\u306b\u3057\u3066\u304f\u308c\u308b\u95a2\u6570\u306a\u306e\u3067<br \/>\n\u305c\u3072\u7406\u89e3\u3057\u3066\u4f7f\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u3053\u306e\u8a18\u4e8b\u3067\u306fPython\u3067\u3088\u304f\u4f7f\u3046enumerate\u95a2\u6570\u306e\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u308f\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u3002 \u3010Python\u3011enumerate\u95a2\u6570\u3092\u4f7f\u3046\u524d\u306b enumerate\u95a2\u6570\u306e\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u7406\u89e3\u3059\u308b\u305f\u3081\u306b \u307e\u305a\u3001for [&hellip;]","protected":false},"author":1,"featured_media":1105,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16,39],"tags":[132,3],"_links":{"self":[{"href":"https:\/\/python-introduction.com\/index.php?rest_route=\/wp\/v2\/posts\/1269"}],"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=1269"}],"version-history":[{"count":4,"href":"https:\/\/python-introduction.com\/index.php?rest_route=\/wp\/v2\/posts\/1269\/revisions"}],"predecessor-version":[{"id":1273,"href":"https:\/\/python-introduction.com\/index.php?rest_route=\/wp\/v2\/posts\/1269\/revisions\/1273"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/python-introduction.com\/index.php?rest_route=\/wp\/v2\/media\/1105"}],"wp:attachment":[{"href":"https:\/\/python-introduction.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1269"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/python-introduction.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1269"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/python-introduction.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}