<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>minus9d</author_name>
  <author_url>https://blog.hatena.ne.jp/minus9d/</author_url>
  <blog_title>minus9d's diary</blog_title>
  <blog_url>https://minus9d.hatenablog.com/</blog_url>
  <categories>
    <anon>python</anon>
  </categories>
  <description>Pythonではファイルを開くときなどにwithを使うのが定石である（参考：ファイル - Dive Into Python 3 日本語版）。しかし、複数のファイルを開くときには以下のようにネストが発生してしまうのが気に入らなかった。 with open('a.txt', 'w') as f1: with open('b.txt', 'w') as f2: # 処理 Multiple variables in Python 'with' statement - Stack Overflow によると、以下のコードでネストを回避できる。Python 2.7とPython 3.1以降で利用可能らしい…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fminus9d.hatenablog.com%2Fentry%2F2016%2F09%2F22%2F194316&quot; title=&quot;pythonでwithによるネストを防ぐ - minus9d&amp;#39;s diary&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>2016-09-22 19:43:16</published>
  <title>pythonでwithによるネストを防ぐ</title>
  <type>rich</type>
  <url>https://minus9d.hatenablog.com/entry/2016/09/22/194316</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
