Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to convert string to function name in python

def add(x,y):
	print('does something')
    
eval("add")(x,y)
Comment

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
Comment

PREVIOUS NEXT
Code Example
Python :: validationerror django params 
Python :: django httpresponse 
Python :: python dataframe contains value 
Python :: django add to database 
Python :: openpyxl get row from sheet 
Python :: change tuple python 
Python :: flask migrate multiple heads 
Python :: drf not getting form 
Python :: symmetrical sum python 
Python :: rename colonne pandas 
Python :: calculate area under the curve in python 
Python :: python string: .lower() 
Python :: telegram.ext python 
Python :: how to change padding of dbc.col 
Python :: python requests with authorisation token 
Python :: developpement limité sinus python 
Python :: replace() python 
Python :: python map function 
Python :: Flatten List in Python Using NumPy concatenate 
Python :: seaborn boxplot change filling 
Python :: python string lowercase 
Python :: python not showing in control panel but showing not installed 
Python :: set page title name and favicon in streamlit 
Python :: python string name out of mail 
Python :: remove grid in imshow 
Python :: sample adaboost classifier algorithm 
Python :: binary search iterative 
Python :: pip ne marche pas 
Python :: python tabulate without index 
Python :: discord chatterbot python 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =