A
A
Andrey Prenrek2021-09-28 17:57:53
Python
Andrey Prenrek, 2021-09-28 17:57:53

How to call a function?

I have a list of functions to be called: How can I call them and pass arguments to them?

nam = ["main","ru",'run']

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Golovanenko, 2021-09-28
@Frotryi

If the listed functions are in the global namespace:

for function_name in nam:
    globals()[function_name](<аргументы>)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question