<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>fnwiya</author_name>
  <author_url>https://blog.hatena.ne.jp/fnwiya/</author_url>
  <blog_title>fnwiya's quine</blog_title>
  <blog_url>https://fnwiya.hatenablog.com/</blog_url>
  <categories>
    <anon>103.python</anon>
    <anon>100.Tech</anon>
  </categories>
  <description>pythonでファイルを開くときはopenしてcloseするのが伝統的なやり方ですが、 うっかりcloseするのを忘れると困るのでwithを使うやり方がおすすめです。 #!/usr/bin/python # -*- coding: utf-8 -*- import sys f = open(sys.argv[1]) line = f.readline() f.close() ↑じゃなくて↓がおすすめ #!/usr/bin/python # -*- coding: utf-8 -*- import sys with open(sys.argv[1]) as f: line = f.readlin…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ffnwiya.hatenablog.com%2Fentry%2F2016%2F01%2F06%2F210000&quot; title=&quot;pythonでのファイル入力はwithを使おう - fnwiya&amp;#39;s quine&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-01-06 21:00:00</published>
  <title>pythonでのファイル入力はwithを使おう</title>
  <type>rich</type>
  <url>https://fnwiya.hatenablog.com/entry/2016/01/06/210000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
