【问题标题】:Create NSDictionary from Python dictionary从 Python 字典创建 NSDictionary
【发布时间】:2013-01-23 02:47:44
【问题描述】:

如何从 Python 字典中获取 NSDictionary(以便我可以调用 description)?

【问题讨论】:

    标签: macos nsdictionary pyobjc


    【解决方案1】:
    >>> d = NSDictionary.dictionaryWithDictionary_({"foo": "bar"})
    >>> type(d)
    <objective-c class __NSDictionaryI at 0x7fff7ae34688>
    >>> d.description()
    u'{\n    foo = bar;\n}'
    >>> d
    {
        foo = bar;
    }
    >>> 
    

    【讨论】:

      猜你喜欢
      • 2014-10-02
      • 2016-11-20
      • 2021-06-25
      • 2019-07-24
      • 1970-01-01
      • 1970-01-01
      • 2016-07-11
      • 2017-05-05
      • 1970-01-01
      相关资源
      最近更新 更多