ipad 应用程序将此 json 发送给我,我通过 request.POST.get 读取它,然后通过ast.literal_eval 解析它
u'[\n {\n "type" : 2,\n "dateCreated" : "Wed, 24 Apr 2013 17:20:50 0100",\n "dateStart" : "Wed, 24 Apr 2013 18:00:00 0100",\n "appointmentId" : 0,\n "withP" : [\n\n ],\n "seenTime" : null,\n "ofCWithId" : 2,\n "ofClientWithId" : 68,\n "dateEnd" : "Wed, 24 Apr 2013 19:00:00 0100",\n "comments" : "Test test test\n.\n( ) \'\' test \'\' \' test \'\n",\n "inLocation" : null,\n ...bla bla bla...]'
我收到此错误:
'comments' : 'Test test test
^
SyntaxError: EOL while scanning string literal
我可以理解换行符是问题,但我不知道如何解决。我正在使用 django 1.4.2 python 2.7.3
我真的很感谢你的帮助