在Postgresql数据库中有page
表,用于保存页面信息。
在页面创建过程中,空格 is added in the
pagetitle
值,但在代码中,我从pagetitle
-Detailed findings
查找页面对象。所以有办法找到这个(就像python中的子字符串>>> "abc".__contains__("a")
代码为:
>>> page.objects.filter(pagetitle = "Detailed findings", doc=a)
[]
>>> page.objects.filter(pagetitle = "Detailed findings ", doc=a)
[<page: o-0235931>]
谢谢你
正在工作
>>> page.objects.filter(pagetitle__contains="Detailed findings", doc=a)
[<page: o-0235931>]
>>> page.objects.filter(pagetitle__contains="detailed findings", doc=a)
[]
>>> page.objects.filter(pagetitle__icontains="detailed findings", doc=a)
[<page: o-0235931>]
使用contains或不区分大小写的icontains查找:
相关问题 更多 >
编程相关推荐