Demo
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
@File : server.py
@Time : 2023-02-08 11:30
@Author : 坐公交也用券
@Version : 1.0
@Contact : faith01238@hotmail.com
@Homepage : https://liumou.site
@Desc : 当前文件作用
"""
from flask import Flask
from sn_txt import i
app = Flask(__name__)
@app.route("/")
def welcome():
return "Hello World!"
@app.route("/<sn>", methods=["GET"])
def sn(sn):
mess = f"匹配失败({str(sn)})"
for s in i:
if str(sn).upper() == str(s).upper():
mess = f"匹配成功({str(sn)})"
return mess
if __name__ == "__main__":
app.run()
app.run(host="localhost", port=5000, debug=True)
运行
访问效果