I have been following a tutorial on using BeautifulSoup, however when I try to read the title or even paragraphs (using soup.p) I get an error saying, "Traceback (most recent call last): File "*****/Tutorial1.py", line 9, in pTag = soup.p AttributeError: 'str' object has no attribute 'p'"
I am still very new to Python, sorry to bother if these is too much of an easy issue but I will greatly appreciate any help. Code given below:
import urllib.request
from bs4 import BeautifulSoup
with urllib.request.urlopen('http://www.bbc.co.uk/sport/0/netball/33717953') as response:
page = response.read()
soup = BeautifulSoup(page, "html5lib")
soup = soup.prettify()
pTag = soup.p
print(pTag)