我对python中正则表达式的搜索有问题
文本的某些部分如下所示:
<h3 class="space">Status ogłoszenia</h3>
<div class="under-space gray-row">Aktualne</div>
我想找一个词来代替“Aktualne”,它可以是很多不同的词。 所以我搜索第二行
我已经编写了一些正则表达式代码:
soup = BeautifulSoup(reqs.text, 'lxml')
r = re.search("Status ogłoszenia</h3>\n(.)*</div>", str(soup))
r = str(r)
在输出中,我有:
'<re.Match object; span=(7128, 7199), match=\'Status ogłoszenia</h3>\\n<div class="under-space g>'
所以它不是完全输出。少了一部分
如何将此代码更改为具有完整输出,或者它对我来说是未知的正则表达式行为
search()
返回一个MatchObject
,下面是您要做的:相关问题 更多 >
编程相关推荐