python - How to give default argument if starred expression is empty -


i have function call tkinter optionmenu, looks this:

tk.optionmenu(container, targetvar, *list(accountmap)) 

accountmap dictionary of values i'd appear in optionmenu, in scenarios may dictionary empty, meaning starred expression doesn't return arguments, , function call optionmenu complains not enough arguments have been given. how can add default value of empty string if starred expression returns nothing?

*(accountmap or [""]) 

the list redundant.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

android - How to prevent keyboard from closing when bottom dialog is open? -