Differences
This shows you the differences between two versions of the page.
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** |
- | < | + | 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 ====== | ||
+ | |||
+ | < | ||
if __name__ == ' | if __name__ == ' | ||
main() | main() | ||
</ | </ | ||
+ | |||
+ | ===== Explanation ===== | ||
It may include other statements as well. | It may include other statements as well. |