Find a link that contains a specific word using BeautifulSoup
You can do it with a simple “contains” CSS selector: soup.select(“a[href*=location]”) Or, if only one link needs to be matched, use select_one(): soup.select_one(“a[href*=location]”) And, of course, there are many other ways – for instance, you can use find_all() providing the href argument which can have a regular expression value or a function: import re soup.find_all(“a”, … Read more