这是我使用的示例表,所有按钮都与此处类似。用于此目的的数据存储在服务器的内存中,并在按下按钮后生成。
<pre>
<table align="center" class="comic_list">
<tr>
<td><a href="{{url_for('alpha')}}"><button type="submit" value="A">A</button></a></td>
<td><a href="{{url_for('mastercomics', _anchor= 'Action Label')}}"><button type="submit" value="Action Label">Action Label</button></a></td>
</tr>
</table>
</pre>
谢谢 扎克
答案 0 :(得分:0)
main.py
program.exe
index.html
from flask import Flask
from flask import render_template, url_for, request, redirect
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/alpha', methods = ['GET', 'POST'])
def alpha():
master_data = pd.read_csv('path to the csv file')
return render_template('index.html', data=master_data.to_html())
@app.route('/mastercomics/<string:anchor>')
def mastercomics(anchor):
master_data = pd.read_csv('path to the csv file')
return render_template('index.html', data=master_data.to_html())
if __name__ == '__main__':
app.run()
希望这会有所帮助!