Sometimes, we want to get a function name as a string with Python.
In this article, we’ll look at how to get a function name as a string with Python.
How to get a function name as a string with Python?
To get a function name as a string with Python, we can use the __name__ property.
For instance, we write
my_function.__name__
to get the __name__property of my_function to return my_function‘s name as a string.
Conclusion
To get a function name as a string with Python, we can use the __name__ property.