python_wiki:if_name_main

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
python_wiki:if_name_main [2014/11/19 22:07]
billdozor created
python_wiki:if_name_main [2019/05/25 23:50] (current)
Line 1: Line 1:
 ====== if __name__ main ====== ====== if __name__ main ======
  
-Many python source files include a section like this:+**General Information**
  
-<code>+Many python source files will have an interesting if statement around main(). This is why it exists. 
 + 
 +**Checklist** 
 +  * Python versions: 2 and 3 
 + 
 +---- 
 + 
 +====== The Code ====== 
 + 
 +<code python>
 if __name__ == '__main__': if __name__ == '__main__':
   main()   main()
 </code> </code>
 +
 +===== Explanation =====
  
 It may include other statements as well. It may include other statements as well.
  • python_wiki/if_name_main.1416452823.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)