Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create NSDictionary from Python dictionary

How do I get an NSDictionary from a Python dictionary (so that I can call description on it) ?

like image 609
Thilo Avatar asked Jun 21 '26 22:06

Thilo


1 Answers

>>> d = NSDictionary.dictionaryWithDictionary_({"foo": "bar"})
>>> type(d)
<objective-c class __NSDictionaryI at 0x7fff7ae34688>
>>> d.description()
u'{\n    foo = bar;\n}'
>>> d
{
    foo = bar;
}
>>> 
like image 128
bdash Avatar answered Jun 24 '26 17:06

bdash