-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
32 lines (24 loc) · 790 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from bs4 import BeautifulSoup
with open('tailwind-landing-page-main/index.html','r',encoding="utf8") as html_file:
content = html_file.read()
# print(content)
soup = BeautifulSoup(content, 'lxml')
# print(soup.prettify())
tags = soup.find_all('h2')
# for tag in tags:
# print(tag.text.strip())
lists = soup.find_all(True, {'class':['flex', 'space-y-3']})
new_list = []
for list in lists:
title = list.h3
if title is not None:
# print(title.text.strip())
new_list.append(title.text.strip())
# new_list = list(dict.fromkeys(new_list))
new_list = set(new_list)
my_list = [*new_list, ]
print(my_list)
l = []
for i in new_list:
l.append(i)
print(l)