<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # 28 set和with語句以及模板中定義變量 在模板中,可以使用"set"語句來定義變量,示例如下: ```text 格式: {% set 變量名=值 %} {{ 變量名 }} ``` ```text """html <!--定義變量--> {% set username="miku" %} <p>用戶名:{{ username }}</p> """ 一旦定義了這個變量,那么后面的代碼中,就可以使用這個變量 ### 'with'語句: 'with'語句定義的變量,只能在'with'語句中使用,就不能再使用了,示例如下: """html {% with classroom = "angle" %} <p>名字:{{ classroom }}</p> {% endwith %} {{ clssroom }} """ 'with'語句也不一定要跟一個變量,可以定義一個空的'with'語句,以后在'with'塊中通過'set'定義的變,就只能在這個'with'塊中使用了: """html {% with %} {% set classroom = "1班" %} <p>班級:{{classroom}}</p> {% endwith %} """ ``` ```text app.py from flask import Flask, render_template app = Flask(__name__) app.config["TEMPLATES_ATUO_RELOAD"] = True @app.route('/') def hello_world(): return render_template("index.html") if __name__ == '__main__': # app.run(debug=True) app.run(host="0.0.0.0") ``` ```text index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <!--定義變量--> {% set username="angle" %} <p>用戶名:{{ username }}</p> <div> {% with classroom="angle" %} <p>名字:{{ classroom }}</p> {% endwith %} {{ classroom }} </div> </body> </html> ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看