Open
Description
This is what my code looked like -
it is set to ignore the SSL Certifications which could have created errors.
import urllib.request
from bs4 import BeautifulSoup
url = 'http://py4e-data.dr-chuck.net/known_by_Nia.html'
count = int(input('Enter count:'))
position = int(input('Enter position:'))
postion=int(position)-1
html = urllib.request.urlopen(url)
html = html.read()
soup = BeautifulSoup(html,"html.parser")
href = soup('a')
#print ("Retrieving:",href)
for i in range(count):
print ("Retrieving:",href[i])
link = href[position].get('href', None)
result = (href[position].contents[0])
html = urllib.request.urlopen(url)
html = html.read()
soup = BeautifulSoup(html,"html.parser")
href = soup('a')
print(result)
Metadata
Metadata
Assignees
Labels
No labels