【发布时间】:2013-05-03 07:57:54
【问题描述】:
我的 Tornado 应用程序通过 http 正文请求接受 POST 数据
在我的处理程序中,我能够得到请求
def post(self):
data = self.request.body
我得到的数据在 str(dictionary) 的 from 中
有没有办法以 Python 字典的形式接收这些数据?
我不想在服务器端使用eval 将此字符串转换为 Python 字典。
【问题讨论】:
-
可能是JSON字符串。
-
有没有办法在不使用 eval 的情况下将此 json 字符串转换为 python 字典。
-
此json字符串包含空格,其他json库无法将其转换为python字典
-
你能发个样本吗?
-
{ \n \"_id\" : \"cd4cca2_9vg5jyuwqxgmxfr\", \n \"time\" : '2012-01-01', \n \"opening_type\" : \"召回\", \n }"
标签: python python-2.7 tornado