What about
"".decode('string_escape')?
http://stackoverflow.com/questions/1885181/how-do-i-un-escape-a-backslash-escaped-string-in-python
David
On Friday, February 14, 2014 4:53:48 PM UTC-7, SAHIL SHEKHAWAT wrote:
>
> I have already used escape filter but it only escapes <,>,..etc but not
> backslash..
> due to escape filter i was able to get the html string to be displayed
> into my json output...but now i want to remove all the escaping(extra)
> backslashes..
>
> On Saturday, February 15, 2014 4:50:30 AM UTC+5:30, SAHIL SHEKHAWAT wrote:
>>
>> please help me out!
>> i am passing mathjax generated from result set of sympy_gamma as json to
>> template of django which include escape sequences and i want python( or
>> django) to interpret it but json.dumps return a string so it is getting
>> passed as it is. ( e.g. double backslash instead of single one)
>> If passed as variable it is rendered correctly but as json it doesn't.
>> have two ways but they are not very efficient and i have doubts with both.
>> 1) replace the double backslash with single. ( but '\n' can also come and
>> its is not predictable but all cases can be included and
>> my_string.replace('\\\\','\\') is not working)
>> 2) passing the values as variables and then after rendering adding them
>> as strings.( but we want double quotes instead of single so have to dump to
>> json in JS somehow)
>> thanks
>>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.