<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>pydoc</author_name>
  <author_url>https://blog.hatena.ne.jp/pydoc/</author_url>
  <blog_title>PyDocument</blog_title>
  <blog_url>https://pydocument.hatenablog.com/</blog_url>
  <categories>
    <anon>Python</anon>
  </categories>
  <description>Pythonを使ってテキストファイルを読み込む際に発生しやすいエラーとその対処法について解説します。 基本: テキストファイルの読み込み よくあるエラーとその原因、対処法 例外処理のサンプルコード まとめ 基本: テキストファイルの読み込み Pythonでテキストファイルを読み込むには、open()関数とwith文を組み合わせるのが一般的です。 with open(&quot;sample.txt&quot;, &quot;r&quot;, encoding=&quot;utf-8&quot;) as f: content = f.read() print(content) ファイルのエンコードの指定に指定について: encoding=&quot;...&quot; エン…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fpydocument.hatenablog.com%2Fentry%2F2023%2F03%2F23%2F000832&quot; title=&quot;Pythonでのテキストファイル読み込み際に発生するエラーと対処法 - PyDocument&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>https://hbb.afl.rakuten.co.jp/hgb/19a27560.c8b57319.19a27561.0f5a4f2e/?me_id=1213310&amp;item_id=20113424&amp;pc=https%3A%2F%2Fthumbnail.image.rakuten.co.jp%2F%400_mall%2Fbook%2Fcabinet%2F9274%2F9784873119274_1_2.jpg%3F_ex%3D240x240&amp;s=240x240&amp;t=pict</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2023-03-23 00:08:32</published>
  <title>Pythonでのテキストファイル読み込み際に発生するエラーと対処法</title>
  <type>rich</type>
  <url>https://pydocument.hatenablog.com/entry/2023/03/23/000832</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
