如何使用Python NET在Python中创建字符串,对象的字典?
C#
d = new Dictionary<string,object>() // works
Python
Dictionary [string, object] # TypeError : type(s) expected
答案 0 :(得分:0)
您可以这样创建它:
import clr
from System.Collections.Generic import Dictionary
from System import String
from System import Object
d = Dictionary[String, Object]()
d['Entry 1'] = 'test'
d['Entry 2'] = 12.3
d.Count # returns 2