title: Filtering the list of html links using a specific key word using Python
body: <p>I am trying to extract the links using a specific work in each link in the list of links. Below is the code that I get the URLs:</p>
  <pre><code>import urllib
  
  from bs4 import BeautifulSoup as bs    
  url ='https://fbref.com/en/squads/b8fd03ef/Manchester-City-Stats'
  html_page = urllib.request.urlopen(url)
  soup = bs(html_page, &quot;html.parser&quot;)
  links = []
  player_link =[]
  for link in soup.findAll('a'):
      links.append(link.get('href'))
  </code></pre>
  <p>From the above lines of code, I can store the list of links in the variable <strong>links</strong>
  I want to create a new list containing only the specific word <strong>summary</strong>.
  The expected output ( only part of all) that should be stored in a new list <strong>player_list</strong> is shown below:</p>
  <pre><code> player_list =['/en/players/3bb7b8b4/matchlogs/2021-2022/summary/Ederson-Match-Logs',
      '/en/players/3eb22ec9/matchlogs/2021-2022/summary/Bernardo-Silva-Match-Logs',
      '/en/players/bd6351cd/matchlogs/2021-2022/summary/Joao-Cancelo-Match-Logs',
      '/en/players/31c69ef1/matchlogs/2021-2022/summary/Ruben-Dias-Match-Logs',
      '/en/players/6434f10d/matchlogs/2021-2022/summary/Rodri-Match-Logs',
      '/en/players/119b9a8e/matchlogs/2021-2022/summary/Aymeric-Laporte-Match-Logs']
  </code></pre>
  <p>I tried exploring some of the previous posts, but it did not work out. What can I try next?</p>