I am new to Python and I am struggling with the task of passing a dictionary, whose keys are tuples, as an argument to a function.
mydict = {('hostabc', 'pola'): 333444567, ('hostdef', 'polb'): 111222333, ('hostghi', 'polc'): 222999888}
def tupletest(**kwargs):
print(kwargs)
tupletest(**mydict)
The following keyword error is generated:
TypeError Traceback (most recent call last)
<ipython-input-29-fec409a1eb53> in <module>
2 def tupletest(**kwargs):
3 print(kwargs)
----> 4 tupletest(**mydict)
TypeError: tupletest() keywords must be strings
I am unsure if this is even possible given the error msg. I am testing this in 3.7.4
All help appreciated.