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
Post a Comment