简体   繁体   English

Python Flask 调用函数

[英]Python Flask Calling Functions

Is it possible within the html template to call a python function?是否可以在 html 模板中调用 python function? for example:例如:

Call a function to check for a word within an input on the keypress event?调用 function 来检查按键事件输入中的单词?

Thanks谢谢

You are able to call function in Flask, yes您可以在 Flask 中调用 function,是的

for example:例如:

def say_smt():
  print("hey")

@app.route('/')
def site():
  say_smt()

however using an input() would initiate a break in the whole script, so it would crash the whole Flask Server so that's not possible.但是使用 input() 会在整个脚本中启动中断,因此它会使整个 Flask 服务器崩溃,所以这是不可能的。 Please be more specific about what your goal is请更具体地说明您的目标是什么

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM