Reputation: 4085
I was wondering if there are any intuit functionality that I can use to go from string dict to unicode dict.
Input:
{'name': 'Lexus', 'model': 'GS F'}
Expected output:
{u'name': u'Lexus', u'model': u'GS F'}
Upvotes: 0
Views: 145
Reputation: 1318
>>> d={'name': 'Lexus', 'model': 'GS F'}
>>> d={k.decode('utf8'): v.decode('utf8') for k, v in d.items()}
output :
{u'model': u'GS F', u'name': u'Lexus'}
Upvotes: 1