I had previously extract some information in the webpage using BeautifulSoup4: https://www.peakbagger.com/list.aspx?lid=5651
And I got a list of a href:
from urllib.request import urlopen
from bs4 import BeautifulSoup
import pandas as pd
url = 'https://www.peakbagger.com/list.aspx?lid=5651'
html = urlopen(url)
soup = BeautifulSoup(html, 'html.parser')
a= soup.select("a:nth-of-type(1)")
a
But I would only wants the one with the links starting on 'peak.aspx?pid=10...'
How do I only print out the ones with 'peak.aspx?pid=10...', do I need to use a loop or split it?
Thanks.
Aucun commentaire:
Enregistrer un commentaire