django - '|' 是什么意思 在 {{ services|pprint|safe }} 在 django 中是什么意思?
问题描述
我知道在 views.py 文件中:
def index(request):
person= {'firstname': 'Craig', 'lastname': 'Daniels'}
weather= "sunny"
context= {
'person': person,
'weather': weather,
}
return render(request, 'Articles/greeting.html', context)
然后我们可以在greetings.html中做:
<h1>Hi {{ person.firstname }} {{ person.lastname }}</h1>
<h1>Today it is {{ weather }}</h1>
其中 {{ person.firstname }} 是在上下文中定义的变量。
但是'|'是什么 意思是?
{{ services|pprint|safe }}