+ 1
Is there a way to use dictionary mapping to get methods invoked?
DICTIONARY python
4 Answers
+ 2
The same as you would with any dictionary
https://code.sololearn.com/cq12Bd2tgatz/?ref=app
0
Yes
{
"Name": function(*args,**kwargs)
}
you can store many functions this way and then iterate through them, or call them by their key
0
What if this DICTIONARY needs to be accessed inside the if main ==" __main__ "?
example:
cmd_dict = {'play song': music()}
.....................
............. ......
if main ==" __main__":
0
Thanks