Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的python代码中,我有以下行,它将UTC格式的当前日期存储在mongodb数据库的字段中:
s['metadata']['some_date'] = datetime.utcnow()
但是在运行程序时,我收到以下错误:
TypeError:“unicode”对象不支持项目分配
我的代码有什么问题以及如何解决?
请帮忙谢谢
's' 或 s['metadata'] 是字符串,但不是 dict....pdb 是您的朋友。