gpt4 book ai didi

javascript - 在 HTML 网页中运行 python 方法

转载 作者:行者123 更新时间:2023-12-02 14:44:34 24 4
gpt4 key购买 nike

我有一个带有按钮的 HTML 页面。该网页在 Flask 上运行。我想做的是当用户按下按钮时,我想调用Python方法。

main.py

from flask import url_for, Flask, render_template

app = Flask(__name__)

@app.route('/')
def hello_world():
return render_template('tour.html')

if __name__ == '__main__':
app.run(debug=True)

def first():
global todayDate
parseWemake(*Wemake.wemakeData())
parseCoupang(*Coupang.coupangData())
parseTmon(*Tmon.tmonData())

游览.html

<button>Click</button>

我现在迷路了。我想做的就是在 html 上单击该按钮时调用 first() 方法。

提前致谢。

最佳答案

这是不可能的。

因为“点击”发生在浏览器中,但“首先”在您的服务器上运行。

您需要的是 html 表单或 ajax 请求。

关于javascript - 在 HTML 网页中运行 python 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36713877/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com