学习日报

学习内容:Flask简单操作

代码示例:

from flask import Flask
from flask import request
from flask import render_template

app = Flask(__name__)

@app.route("/tem")
def index2():
return render_template("index.html")

@app.route("/login")
def index1():
name=request.values.get("name")
pwd=request.values.get("pwd")
return f'name={name},pwd={pwd}'


@app.route("/abc")
def index():
id = request.values.get("id")
return f"""
<form action="/login">
账号:<input name="name" value="{id}"><br>
密码:<input name="pwd">
<input type="submit">
</form>
"""
if __name__ == '__main__':
app.run(debug=True)
posted @ 2021-03-26 13:44  CherriesOvO  阅读(78)  评论(0编辑  收藏  举报