dictionary - iterate at a function input in python -


i need transfer values in dict (dict1 in example below) function in element element manner (func1 in example below, function can not changed)

def func1(input1,input2,input3):     print input1     print input2     print input3  dict1={"a":1,"b":2,"c":3} keys=["a","b","c"] func1(dict1["a"],dict1["b"],dict1["c"]) 

how can improve last line of array keys? have tried

func1([dict[key] key in keys]) 

and

func1(dict[key] key in keys) 

your func1([dict[key1] key in keys]) worked, need unpack before sending function using *

func1(*[dict1[key] key in keys]) 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -