from flask import Flask, request, Response
from flask_request_params import bind_request_params
import pandas as pd
app = Flask(__name__)
app.before_request(bind_request_params)
@app.route('/')
def hello_world():
return 'Hello World!'
@app.route('/get', methods=['GET'])
def get_text():
text = request.args.get('id')
df = get_data(text)
return df.to_html(header="true", table_id="table")
def get_data(id):
df = pd.DataFrame({'col1': ['abc', 'def', 'tre'],
'col2': ['foo', 'bar', 'stuff']})
return df
if __name__ == '__main__':
app.run(host='0.0.0.0')
<div class="table_entrances" style="overflow-x: auto;">
<table id="table">
<thead></thead>
<tr></tr>
</table>
</div>
![在这里插入图片描述](https://img-blog.csdnimg.cn/20200430132013472.png)