How do I find the current module name?



How do I find the current module name?..

Answer / Avneesh Chittodia

In Python, you can use the `__name__` variable to get the name of the currently running module. If you're inside a module file (e.g., `my_module.py`), `__name__` will be set to `'__main__'`. If you import the module in another script, `__name__` will contain the module name.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

What a blank curly brace initialize? A dictionary or a set?

1 Answers  


What does a function of python programming?

1 Answers  


What is the incorrect declaration of a set?

1 Answers  


What is os module?

1 Answers  


How will you reverse a list?

1 Answers  


Is python scripting easy to learn?

1 Answers  


Explain join() and split() in python.

1 Answers  


Is node better than python?

1 Answers  


Explain the use of *args, **kwargs?

1 Answers  


What is scheduling in threading?

1 Answers  


What does the *args do in python?

1 Answers  


Can we use else block with for loop? Answer with one example.

1 Answers  


Categories