<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>alicehimmel</author_name>
  <author_url>https://blog.hatena.ne.jp/alicehimmel/</author_url>
  <blog_title>ゲシュタルト崩壊間近</blog_title>
  <blog_url>https://alicehimmel.hatenadiary.org/</blog_url>
  <categories>
    <anon>Python</anon>
  </categories>
  <description>Pythonの構文でリスト内包表記というのがあります。 何かというと、 &gt;&gt;&gt; for i in range(1,10): ... print iというプログラムを、 &gt;&gt;&gt; [ i for i in range(1,10)] [1, 2, 3, 4, 5, 6, 7, 8, 9]こういう風に書けるものです。ワンライナーで書くときは重宝しますね。で、これをみた方は、「じゃあif文はどうするんだ？」と思うと思います。 実はif文もリスト内包表記で書けるのです。 &gt;&gt;&gt; [i for i in range(10) if i % 2 == 0] [0,2,4,6,8]for文のすぐ後に書くと、こうや…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Falicehimmel.hatenadiary.org%2Fentry%2F20101129%2F1291021249&quot; title=&quot;リスト内包表記について【教えてください】 - ゲシュタルト崩壊間近&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2010-11-29 18:00:49</published>
  <title>リスト内包表記について【教えてください】</title>
  <type>rich</type>
  <url>https://alicehimmel.hatenadiary.org/entry/20101129/1291021249</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
