I was exception the following to work.
def foo(**kwargs):
print kwargs
foo(**{'a':'b'})
foo(**{u'a':'b'})
Traceback (most recent call last): File "", line 1, in TypeError: m() keywords must be strings
Am I doing something wrong or I should I fix it?
Upgrade to Python 2.6.5 or later.
Upgrading wasn't an option for me so I'm calling this on dicts as needed--
def flatten_unicode_keys(d):
for k in d:
if isinstance(k, unicode):
v = d[k]
del d[k]
d[str(k)] = v
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With