1 2 3 4 |
<span class="cm-builtin">list</span> = [<span class="cm-string">"a"</span>, <span class="cm-string">"b"</span>] <span class="cm-keyword">for</span> <span class="cm-variable">index</span>, <span class="cm-variable">value</span> <span class="cm-keyword">in</span> <span class="cm-builtin">enumerate</span>(<span class="cm-builtin">list</span>): <span class="cm-builtin">print</span>(<span class="cm-variable">index</span>, <span class="cm-variable">value</span>) |
出力結果
1 2 |
<span class="cm-number">0</span> <span class="cm-variable">a</span> <span class="cm-number">1</span> <span class="cm-variable">b</span> |