With the following code:
url ='http://lampspw.wallonie.be/dgo4/site_ipic/index.php/fiche/index?sortCol=2&sortDir=asc&start=0&nbElemPage=10&filtre=&codeInt=62121-INV-0018-02'
soup = BeautifulSoup(page.content, 'html.parser')
t = soup.find_all("div", attrs={'class':'panel-heading'})
lst = [x.text for x in t]
I obtain:
['\xa0Filtres complémentaires',
'\xa0Recherche dans les notices',
'Libellé(s)\xa0',
'Illustration(s)',
'Localisation',...]
If I look for a particular tag (contained in that list) directly in soup with a substring:
In [290]: soup.find_all("div", string=re.compile('Locali'))
Out[291]: [<div class="panel-heading">Localisation</div>]
I find back one of the previous tag I want. But if i do:
In :soup.find_all("div", string=re.compile('Libe'))
Out: []
Can someone explain the problem here? I guess it lies within the html code, but I do not find it...