title: Why does it do this ? if - __name__ == '__main__'
body: <blockquote>
    <p><strong>Duplicate of:</strong><br>
    <a href="https://stackoverflow.com/questions/419163/what-does-if-name-main-do">What does <code>if __name__== "__main__"</code> do?</a>  </p>
  </blockquote>
  
  
  
  <p>Consider this code:</p>
  
  <pre><code>if __name__ == '__main__':
      import pdb
      pdb.run("interact()\n")
  </code></pre>
  
  <p>What does the following line mean?</p>
  
  <pre><code>if(__name__=='__main__')
  </code></pre>
  
  <p>I fainted.</p>