Skip to content

_This is what my code looked like - #23

Open
@saimouli29

Description

@saimouli29

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions