Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8b48e5c

Browse files
committed
Day16
1 parent c72e4dd commit 8b48e5c

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

‎Day16/q55.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
__author__ = "Mahtab Alam"
2+
3+
4+
from urllib.request import urlopen
5+
from urllib.error import HTTPError, URLError
6+
7+
try:
8+
url = urlopen("http://www.abcxyz.com")
9+
except HTTPError:
10+
print("Http Error")
11+
except URLError:
12+
print("Server not find")
13+
else:
14+
print(url.read())

‎Day16/q56.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Write a Python program to download and display the content of robot.txt for en.wikipedia.org.
2+
3+
import requests
4+
5+
url = requests.get("https://en.wikipedia.org/robots.txt")
6+
print("Robots.txt for Wikipedia")
7+
print("==========================================")
8+
9+
print(url.text)

‎Day16/q57.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import requests
2+
from bs4 import BeautifulSoup
3+
4+
url = requests.get("http://www.example.com/")
5+
6+
soup = BeautifulSoup(url.text, 'html.parser')
7+
8+
print(soup.h1)
9+
10+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /