def getfunctionbyname(module_name, function_name): module = __import__(module_name) return getattr(module, function_name) func = getfunctionbyname('os','listdir') print(func('./'))
def getfunctionbyname(module_name, function_name): module = __import__(module_name) return getattr(module, function_name) func = getfunctionbyname('os','listdir') print(func('./'))