Which special variable in Python represents the name of the current module?

  • __current__
  • __main__
  • __module__
  • __name__
The special variable __name__ represents the name of the current module in Python. When a Python script is run, the value of __name__ is set to '__main__', indicating that it's the main script being executed. In imported modules, __name__ is set to the module's name. It's often used to check if a script is run as the main program or imported as a module.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *