Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
python_wiki:if_name_main [2014/11/24 22:42] billdozor |
python_wiki:if_name_main [2016/11/30 22:00] billdozor [if __name__ main] |
||
---|---|---|---|
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 ===== | ||
<code python> | <code python> | ||
Line 7: | Line 16: | ||
main() | main() | ||
</ | </ | ||
+ | |||
+ | ==== Explanation ==== | ||
It may include other statements as well. | It may include other statements as well. |