Skip to content

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

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
__author__="Mahtab Alam"
2+
3+
4+
fromurllib.requestimporturlopen
5+
fromurllib.errorimportHTTPError, URLError
6+
7+
try:
8+
url=urlopen("http://www.abcxyz.com")
9+
exceptHTTPError:
10+
print("Http Error")
11+
exceptURLError:
12+
print("Server not find")
13+
else:
14+
print(url.read())

Day16/q56.py

+9
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+
importrequests
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

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
importrequests
2+
frombs4importBeautifulSoup
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)
close