摘要: 调用 1 @app.route('/for') 2 def for_statement(): 3 books = [{ 4 'title': '三国演义', 5 'author': '罗贯中', 6 'price': 100 7 }, 8 { 9 'title': '水浒传', 10 'author 阅读全文
posted @ 2023-05-29 14:49 jason2018 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 调用 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 阅读全文
posted @ 2023-05-29 10:32 jason2018 阅读(29) 评论(0) 推荐(0) 编辑
摘要: 待用到时再学习 阅读全文
posted @ 2023-05-29 09:59 jason2018 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 待用到时再学习 阅读全文
posted @ 2023-05-29 09:58 jason2018 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 在模板中,通过过滤器实现对变量的处理。 过滤器本质上是 Python 的函数,它会把被过滤器的值当作第1个参数传送给函数。 自定义过滤器 定义 1 def datetime_format(value, format="%Y-%m-%d %H:%M"): 2 return value.strftime 阅读全文
posted @ 2023-05-29 09:56 jason2018 阅读(9) 评论(0) 推荐(0) 编辑