python - 如何在 Python 中将输入函数与烧瓶一起使用,以捕获用户输入,然后根据该响应发送响应。像对话流
问题描述
如何在 Python 中将输入函数与烧瓶一起使用,以获取用户输入,然后根据该响应发送响应。尝试连续执行此操作,例如对话流方法。
试图公开此命令行终端以捕获 UI 中的用户输入捕获
#Below is the code
df_final = pandas_dedupe.dedupe_dataframe(df,['Company'])
#Below is the resultant output which get displayed in terminal which asks for user response.
#I'm trying to expose this to user and get his response.
Company : reliance captal
Company : reliance captive
0/10 positive, 0/10 negative
Do these records refer to the same thing?
(y)es / (n)o / (u)nsure / (f)inished
解决方案
模板/contact.html
<form action="/contact" method="POST">
<textarea type="text" name="msg"></textarea>
<label>Messege</label>
<button type="submit" class="button buttonBlue">
Submit
</button>
</form>
app.py
数据存储在msg
变量中,您可以根据该变量发送响应
@app.route('/contact', methods=['GET', 'POST'])
def contact():
if request.method == 'POST':
msg = request.form.get('msg')
return render_template("contact.html")
推荐阅读
- firebase - 未处理的异常:断言失败:布尔表达式在使用 Firebase.initializeApp() 时不能为空
- reactjs - onClick 反应组件
- java - Eclipse 中的“所有 2 个分支丢失”错误
- javascript - 显示来自不同包裹跟踪网站的结果:同源策略问题
- javascript - 无法更改 App.js 中的全局语言设置
- tortoise-orm - 如何在乌龟ORM中按日期部分过滤
- in-app-purchase - Alexa 技能“对不起,我无法在此设备上完成您的请求”在 iOS 设备上的技能购买中
- python - 边界碰撞只在pygame中有效
- reactjs - 使用 Gatsby 加载页面后 URL 路径发生变化
- java - 2 Spinners 和 if 语句