Let’s learn about the special variable __name__ in python.

Let’s learn about the special variable __name__ in python.

·

1 min read

In python, there is no main() function. When we run a python program, the code is given to the interpreter, then the given code is to be executed at the level 0 indentation, before doing that it will define a few special variables. name is one such special variable. name is a special variable that will store the current module name.

Syntax : __name__

__name__file.png

testfile.png

imported.png

if.png