Using BeautifulSoup to search HTML for string
The following line is looking for the exact NavigableString ‘Python’: Note that the following NavigableString is found: Note this behaviour: So your regexp is looking for an occurrence of ‘Python’ not the exact match to the NavigableString ‘Python’.