python - newline causes SyntaxError: EOL while scanning string literal -


an ipad application sends json me , read request.post.get , pars 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...]' 

i error:

    'comments' : 'test test test                                ^ syntaxerror: eol while scanning string literal 

i can understand newline character problem don't know how solve it. i'm using django 1.4.2 python 2.7.3

i appreciate help

try add \'\'\' @ beginning of string , @ end.

like this:

u'\'\'\'[\n ... bla bla bla...]\'\'\'' 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -