<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>kerorosho-tai</author_name>
  <author_url>https://blog.hatena.ne.jp/kerorosho-tai/</author_url>
  <blog_title>たけのこ</blog_title>
  <blog_url>https://kerorosho-tai.hatenadiary.jp/</blog_url>
  <categories>
  </categories>
  <description>内包表記条件式は色々できる リスト内包表記というのは便利で、for文と組み合わせて次のようなリストが作れます。 &gt;&gt;&gt; a = [2*x for x in range(5)] &gt;&gt;&gt; a [0, 2, 4, 6, 8] 条件式を加えても同様の機能が得られます。 &gt;&gt;&gt; a = [x for x in range(5) if x%2 == 0] &gt;&gt;&gt; a [0, 2, 4] 次のように書くとエラーになりますが、 &gt;&gt;&gt; a = [x if x%2 == 0 for x in range(5)] SyntaxError: invalid syntax でも、elseで落としどころを用意してあげる…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fkerorosho-tai.hatenadiary.jp%2Fentry%2F2014%2F06%2F22%2F033532&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>2014-06-22 03:35:32</published>
  <title>リスト内包表記と条件式</title>
  <type>rich</type>
  <url>https://kerorosho-tai.hatenadiary.jp/entry/2014/06/22/033532</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
