I'm trying to extract integers from a url with bs4. I imported re to get the numbers but I get the above error. I'm confused and would appreciate some help.
from urllib.request import urlopen
from bs4 import BeautifulSoup
import ssl
import re
# Ignore SSL certificate errors
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
url = input('Enter - ')
html = urlopen(url, context=ctx).read()
soup = BeautifulSoup(html, 'html.parser')
# Retrieve all of the anchor tags
tags = soup('span')
for tag in tags:
re.findall('<span.*[0-9].*',tag)
Link http://py4e-data.dr-chuck.net/comments_314936.html
Output expected: Print the numbers from the link
httplink, why are you usingssl?