I attempting to extract the all the span infomation contained in the 'pre' tag(ex. "span class="n">data") on 'https://www.kaggle.com/arthurtok/interactive-intro-to-dimensionality-reduction/notebook' using BeautifulSoup, but I can not get the information to show up. I keep getting "AttributeError: 'NoneType' object has no attribute 'contents'"
Here is the code I am currently using:
import urllib.request
from bs4 import BeautifulSoup
url = 'https://www.kaggle.com/arthurtok/interactive-intro-to-dimensionality-reduction/notebook'
urlRead = urllib.request.urlopen(url).read()
soup = BeautifulSoup(urlRead, 'lxml')
prePrint = soup.find("pre").contents[0]
print(prePrint)
Am I reading the webpage incorrectly in urlRead or am I unable to extract the information using BeautifulSoup?