zoukankan      html  css  js  c++  java
  • JAVA日报

    双人结对作业疫情可视化(flask)

    from flask import Flask, jsonify, render_template, request, json

    import MysqlUtil

    app = Flask(__name__)


    @app.route("/")
    def hello():
    return render_template('TEXT.html')


    @app.route("/q1")
    def hellp():
    return "helloworld"


    @app.route("/c2")
    def get_province():
    res0 = []
    res1 = []
    res2 = []
    res3 = []
    for tup in MysqlUtil.get_province():
    res0.append({"name": tup[0], "value": int(tup[1])})
    res1.append({"name": tup[0], "value": int(tup[2])})
    res2.append({"name": tup[0], "value": int(tup[3])})
    res3.append({"name": tup[0], "value": int(tup[4])})
    return jsonify({"confirm": res0, "suspect": res1, "heal": res2, "dead": res3})


    @app.route("/c3", methods=['POST', 'GET'])
    def get_area():
    res0 = []
    res1 = []
    res2 = []
    res3 = []
    name = request.form.get("name")
    for tup in MysqlUtil.get_area(name):
    res0.append({"name": tup[0]+"市", "value": int(tup[1])})
    res1.append({"name": tup[0]+"市", "value": int(tup[2])})
    res2.append({"name": tup[0]+"市", "value": int(tup[3])})
    res3.append({"name": tup[0]+"市", "value": int(tup[4])})
    return jsonify({"confirm": res0, "suspect": res1, "heal": res2, "dead": res3})


    if __name__ == '__main__':
    app.run(debug=True, host='127.0.0.1', port='5000')
  • 相关阅读:
    2020-03-1811:29:37springboot与任务
    2020-03-17 20:18:50springboot整合rabbitmq
    2020.03.17 springboot缓存相关
    前端JS面试
    npm 常用指令
    ES8新特性
    ES7新特性
    ES6新特性
    SpringBoot
    SpringBoot
  • 原文地址:https://www.cnblogs.com/mumulailai/p/14911454.html
Copyright © 2011-2022 走看看