Self-study/Python
[python] __name__
Munyoung
2024. 1. 15. 11:10
1. __name__
- __name__ is a built in variable in every python module.
- Its value is set automatically.
- __name__ is set to the name of the current module.
ex)
- But as soon as code begins running form a file, the __name_ of the file evaluates to '__main__'
- That file's name remains '__main__' for the duration of the program.