Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_This is what my code looked like - #23

Open
saimouli29 opened this issue Jun 8, 2020 · 0 comments
Open

_This is what my code looked like - #23

saimouli29 opened this issue Jun 8, 2020 · 0 comments

Comments

@saimouli29
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant