<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>yuheiomori0718</author_name>
  <author_url>https://blog.hatena.ne.jp/yuheiomori0718/</author_url>
  <blog_title>メモ置き場</blog_title>
  <blog_url>https://y0m0r.hateblo.jp/</blog_url>
  <categories>
    <anon>python</anon>
    <anon>ruby</anon>
  </categories>
  <description>rubyにばかり慣れていたので、pythonの辞書から値を取得しようとして、キーがない場合にErrorになることに、ちょっとだけとまどいました。 せっかくなのでハッシュ/辞書の扱い方のメモを残しておきます。 python my_dict = {&quot;a&quot;: 1, &quot;b&quot;: 2} # 値の取得 print(my_dict[&quot;a&quot;]) # =&gt; 1 # キーがない場合、KeyErrorが発生する try: print(my_dict[&quot;c&quot;]) except: print(&quot;KeyError&quot;) # =&gt; KeyError # あらかじめkeyがあるか調べるにはhas_key if my_dict.h…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fy0m0r.hateblo.jp%2Fentry%2F20111213%2F1323783159&quot; title=&quot;ruby、pythonのハッシュ/辞書の値取得 - メモ置き場&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>2011-12-13 22:32:39</published>
  <title>ruby、pythonのハッシュ/辞書の値取得</title>
  <type>rich</type>
  <url>https://y0m0r.hateblo.jp/entry/20111213/1323783159</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
