【发布时间】:2020-04-20 09:44:42
【问题描述】:
我在 python 烧瓶和 html 文件中创建了一个小应用程序,当我想搜索特定字段时,它只在大小写匹配后搜索,即如果我想搜索印度,它只会在大小写匹配,但是当我搜索印度或印度时,它没有被搜索到?没有显示结果的原因可能是什么? 后来我从stackoverflow的答案中发现,我需要先将其转换为大写,这是答案How to let Python recognize both lower and uppercase input?
但是如何在这里包含它?
<input type="text" class="form-control" id="search" name="search" placeholder="search"
value="{{ request.form['search'] }}"></td>
在我的 py 文件中,它的 if request.method == 'POST':
search = request.form['search'].casefold()
request.form['search'] 中的内容如何转换为 .casefold() 或 .upper() 或 .lower()。请帮帮我。
【问题讨论】:
-
希望你能找到答案here。
标签: python html python-3.x flask