开发者

Error when assigning date in utc format to a field in mongodb from python code

In my python code i have the following line which stores the current date in UTC format in a field in a mongodb database:

s['metadata']['some_date'] = datetime.utcnow() 

But on running the program, i get the following error :

TypeError:开发者_开发问答 'unicode' object does not support item assignment

What is the wrong with my code and how to fix it ?

Please Help Thank You


Either 's' or s['metadata'] is a string but not a dict....pdb is your friend.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜