Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e5f8d72

Browse files
committed
Day8
1 parent de87664 commit e5f8d72

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

Day8/q31.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import requests
2+
from bs4 import BeautifulSoup
3+
4+
url = "https://www.nytimes.com/"
5+
6+
get_url = requests.get(url)
7+
8+
soup = BeautifulSoup(get_url.text,'lxml')
9+
10+
# print(soup.prettify())
11+
print(soup.title)
12+
13+
#d =soup.find_all('div',class_="css-1j836f9 esl82me3")
14+
print(soup.find('div', attrs={'class': 'balancedHeadline'}))
15+
#print(d.text)

Day8/q32.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#Calculate the number of days between two dates
2+
3+
from datetime import date
4+
5+
print("Enter the starting date(yy/mm/dd)")
6+
f_y = int(input())
7+
f_m = int(input())
8+
f_d = int(input())
9+
10+
print("Enter the starting date(yy/mm/dd)")
11+
l_y = int(input())
12+
l_m = int(input())
13+
l_d = int(input())
14+
15+
f_date = date(f_y,f_m,f_d)
16+
l_date = date(l_y,l_m,l_d)
17+
18+
delta = l_date - f_date
19+
20+
print("The number of days between thr dates is: ",delta)

Day8/q33.py

Whitespace-only changes.

0 commit comments

Comments
 (0)