摘要:
调用 1 @app.route('/for') 2 def for_statement(): 3 books = [{ 4 'title': '三国演义', 5 'author': '罗贯中', 6 'price': 100 7 }, 8 { 9 'title': '水浒传', 10 'author 阅读全文
摘要:
调用 1 @app.route('/if') 2 def if_statement(): 3 age = 18 4 return render_template('if.html', age=age) if.html 1 <!DOCTYPE html> 2 <html lang="en"> 3 <h 阅读全文
摘要:
待用到时再学习 阅读全文
摘要:
待用到时再学习 阅读全文
摘要:
在模板中,通过过滤器实现对变量的处理。 过滤器本质上是 Python 的函数,它会把被过滤器的值当作第1个参数传送给函数。 自定义过滤器 定义 1 def datetime_format(value, format="%Y-%m-%d %H:%M"): 2 return value.strftime 阅读全文