Difference between revisions of "If name == " main ":"
Jump to navigation
Jump to search
(One intermediate revision by the same user not shown) | |||
Line 8: | Line 8: | ||
if __name__ == "__main__": | if __name__ == "__main__": | ||
main() | main() | ||
+ | |||
+ | |||
+ | if __name__ == "__main__": | ||
+ | yourfunction() | ||
== Related terms == | == Related terms == | ||
Line 15: | Line 19: | ||
== See also == | == See also == | ||
+ | * {{import}} | ||
* {{Python}} | * {{Python}} | ||
[[Category:Pyhon]] | [[Category:Pyhon]] |
Latest revision as of 09:49, 27 March 2024
https://stackoverflow.com/questions/419163/what-does-if-name-main-do
if __name__ == "__main__":
if __name__ == "__main__": main()
if __name__ == "__main__": yourfunction()
Related terms[edit]
See also[edit]
- import, import (Python):
import [ os | argparse | sys | psutil | yaml | logging | websockets ]
,from
- Python, PIP, GIL, Flask, Django, Marshmallow,
def
, logging, Pandas, Numpy, AWS Chalice,import
,from
,tuple
,list
, Python exceptions,virtualenv
,.append
,pytz
,TZ
,print
,python3 -c
,os
, PEP, Python Institute, Methods: Dunder methods, Flake8, Python collections, Function decorators in Python, Click python library, Python module, Flower,kwargs
, Black (Python), Python list structure, Mypy,variables
, Casting,try:
, pydoc, argparse, Anaconda,pyenv, setup.py, python3 --version, python3 --help
, Data Classes, raise
Advertising: