1

I'm using the following code to read a file into a string, but I want to read it as is, without escaping any characters.

for sheet in style_sheet_list:
    with open (DJANGO_ROOT + "/assets/css/" + sheet + ".css", "r") as myfile:
        style_sheets+=myfile.read()
        style_sheets+="\n"
return style_sheets

For example, I get:

"\f05c";

Instead of:

"\f05c";

How can I do this?

4

1 回答 1

2

这不是 Python 问题;这是 django 转义您的模板变量。使用safe过滤器更正模板输出。

于 2013-05-30T09:22:59.473 回答