Hi all,
I need to pass operator.itemge tter(item,...) multiple arguments but the number of arguments is variable.
What is the syntax for passing operator.itemge tter(items,...) the values of the keyindices list as separate arguments?
Thank you for your help.
I need to pass operator.itemge tter(item,...) multiple arguments but the number of arguments is variable.
Code:
ivlist=['var1','var2','var3'] # This variable changes length keyindices=range(-len(ivlist)-1,0) # = [-4, -3, -2, -1] in this example # What I want in this example is M_keys=M.keys() for key in sorted(M_keys,key=operator.itemgetter(-4, -3, -2, -1)): # for loop code
Thank you for your help.
Comment