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.
Loading...
Related Quiz
- Which library would you primarily use for implementing linear regression in Python?
- How does the break statement affect the else clause associated with a loop?
- The ____ method in Seaborn is used to draw a box plot to show distributions with respect to categories.
- What mode should you open a file in to write to it without deleting its existing content?
- Packages in Python provide a way of organizing related modules into a single _______ directory hierarchy.