Python 在列值中查找子字符串

Python 在列值中查找子字符串,python,django,postgresql,Python,Django,Postgresql,在Postgresql数据库中具有page表,用于保存页面信息。 在页面创建过程中,在pagetitle值中添加空格,但在代码中,我从pagetitle-详细结果中查找页面对象。所以有办法找到这个。(就像python中的子字符串“abc”。\uuuuu包含\uuuuu(“a”) 代码是: >>> page.objects.filter(pagetitle = "Detailed findings", doc=a) [] >>> page.objects.fil

在Postgresql数据库中具有
page
表,用于保存页面信息。 在页面创建过程中,在
pagetitle
值中添加空格
,但在代码中,我从
pagetitle
-
详细结果中查找页面对象。所以有办法找到这个。(就像python中的子字符串“abc”。\uuuuu包含\uuuuu(“a”)

代码是:

>>> page.objects.filter(pagetitle = "Detailed findings", doc=a)
[]
>>> page.objects.filter(pagetitle = "Detailed findings ", doc=a)
[<page: o-0235931>]
>>page.objects.filter(pagetitle=“详细调查结果”,doc=a)
[]
>>>page.objects.filter(pagetitle=“详细调查结果”,doc=a)
[]
多谢各位

正在工作

>>> 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>]
>>page.objects.filter(pagetitle\uuu contains=“Detailed findings”,doc=a)
[]
>>>page.objects.filter(pagetitle\uuuu contains=“详细调查结果”,doc=a)
[]
>>>page.objects.filter(pagetitle\uu icontains=“详细调查结果”,doc=a)
[]
使用或不区分大小写的查找:

page.objects.filter(pagetitle__contains="Detailed findings", doc=a)