<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>uesima</author_name>
  <author_url>https://blog.hatena.ne.jp/uesima/</author_url>
  <blog_title>うえしまさんの備忘録</blog_title>
  <blog_url>https://uesiman.hatenablog.com/</blog_url>
  <categories>
  </categories>
  <description>概要 Pythonでのプログラムを実行する際に直接実行した場合にのみこのプログラムを動かすようにするためのものとのこと。 前から仕事でPythonプログラムを見る機会があり、どういう意味かわかっていなかったが、少しだけ理解が進んだ。 Head First Python5章の以下のサンプルプログラムをみてみるとそういう動きをしているようだ。 - サンプルプログラム print('',__name__) if __name__=='__main__' : print('end:',__name__) 実行結果 (python3_venv) sysadmin@nucserver01:~/head_f…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fuesiman.hatenablog.com%2Fentry%2F2025%2F05%2F14%2F164602&quot; title=&quot;Pythonの if __name__ == &amp;#39;__main__&amp;#39;についてのメモ - うえしまさんの備忘録&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>2025-05-14 16:46:02</published>
  <title>Pythonの if __name__ == '__main__'についてのメモ</title>
  <type>rich</type>
  <url>https://uesiman.hatenablog.com/entry/2025/05/14/164602</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
