<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>potisan</author_name>
  <author_url>https://blog.hatena.ne.jp/potisan/</author_url>
  <blog_title>potisanのプログラミングメモ</blog_title>
  <blog_url>https://potisan-programming-memo.hatenablog.jp/</blog_url>
  <categories>
    <anon>Python 3</anon>
  </categories>
  <description>Python 3にはmore-itertoolsという外部ライブラリがあり、itertools標準ライブラリでコードのみ紹介された関数やその他の便利な関数が提供されています。この記事はfirstとfirst_trueの紹介です。 more-itertoolsのfirstにジェネレーター式を指定すればC++のfind（cpprefjpの文章）やC#のFirst（Microsoft Docsの文章）と同様の機能が得られます。first_trueでラムダ式を指定することもできます。 from more_itertools import first x = first((i for i in rang…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fpotisan-programming-memo.hatenablog.jp%2Fentry%2F2022%2F09%2F20%2F180944&quot; title=&quot;Python3 more-itertoolsのfirst/first_trueで条件に一致する最初の要素を取得する - potisanのプログラミングメモ&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>2022-09-20 18:09:44</published>
  <title>Python3 more-itertoolsのfirst/first_trueで条件に一致する最初の要素を取得する</title>
  <type>rich</type>
  <url>https://potisan-programming-memo.hatenablog.jp/entry/2022/09/20/180944</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
