Answers for "Python How to convert a string to the name of a function?"

2

how to convert string to function name in python

def add(x,y):
	print('does something')
    
eval("add")(x,y)
Posted by: Guest on August-09-2021
0

Python How to convert a string to the name of a function?

def test():
	print("Working")


eval("test")  # function name
# or
eval("test")()  # function call
Posted by: Guest on April-30-2022

Code answers related to "Python How to convert a string to the name of a function?"

Python Answers by Framework

Browse Popular Code Answers by Language