I have a string variable with the exact name of a function, e.g.
ran_test_opt = "random_aoi"
The function looks like this:
def random_aoi():
logging.info("Random AOI Test").
The string is received from a config file and therefore can't be changed. Is there a way I can convert the string into an actual function call so that
ran_test_opt()
would run the random_aoi
function?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…