1

I am new to web scraping. This is the link that I am working on. I extracted the needed information with this code

page = requests.get('https://nepal.globalbajaj.com/en/brands/pulsar/pulsar-ns-200-abs')
soup = BeautifulSoup(page.content, 'html.parser')

specs = soup.find_all(class_='col-md-6 specification')
infos = [spec.find_all('li') for spec in specs] 

print(infos)

I get the results in this form:

[[<li>Type: 4-Stroke - Liquid Cooled, Digital Triple Spark</li>, <li>Max Power: 23.5 @ 9500 (Ps @ RPM)</li>, <li>Max Torque: 18.3 @ 8000 (Nm @ RPM)</li>, <li>Displacement: 199.5 cc</li>, <li>Brake Size Front:  
                                                                        300 mm Disc</li>, <li>Brake Size Rear:  100/80 - 17,52 P Tubeless</li>, <li>Tyre Front:  230mm</li>, <li>Tyre Rear:  130/70 - 17,62 P Tubeless</li>, <li>Brake Type Front:  Hydraulic disc brake with Single channel ABS, Disc diameter 300 ...

It shows error when i use

infos = [spec.find_all('li').get_text() for spec in specs] 

How can I remove those list tags and only get texts ?

0 Answers0