Bootstrap FreeKB - Python (Scripting) - __name__ variable
Python (Scripting) - __name__ variable

Updated:   |  Python (Scripting) articles

The __name__ variable is a special variable in Python that typically returns __main__. For example, let's say you have the following Python script.

#!/usr/bin/python3
print(__name__)

 

Running this script would print __main__ since this is the main script.

]$ python example.py
__main__

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 84c648 in the box below so that we can be sure you are a human.