如何克服“datetime.datetime不能JSON序列化”?
sample = {}sample['title'] = "String"sample['somedate'] = somedatetimehere
jsonify(sample)
TypeError: datetime.datetime(2012, 8, 8, 21, 46, 24, 862000) is not JSON serializable
str(sample['somedate'])
2012-08-08 21:46:24.862000
.
慕哥9229398
相关分类