0
我正在嘗試使用CouchDB的Python包裝來更新數據庫。該文件按如下所示構建爲嵌套字典。爲什麼CouchDb-python(或我)會混淆字符串和字典?
doc = { ...,
'RLSoo': {'RT_freq': 2, 'tweet': "They're going to play monopoly now.
This makes me feel like an excellent mother. #Sandy #NYC"},
'GiltCityNYC': {},
....}
我願把大dicitionary的每個條目,例如RLSoo
到它自己的文件。但是,當我嘗試下面的代碼時,我收到一條錯誤消息。
for key in doc:
db.update(doc[key],all_or_nothing=True)
錯誤消息
TypeError: expected dict, got <type 'str'>
我不明白爲什麼CouchDB的將不接受字典。