We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bc8e290 commit aed28deCopy full SHA for aed28de
Web Scraping/day_45.py
@@ -0,0 +1,29 @@
1
+from bs4 import BeautifulSoup
2
+# import lxml
3
+
4
+with open("website.html", encoding="utf8") as file:
5
+ contents = file.read()
6
7
+soup = BeautifulSoup(contents, "html.parser")
8
+# print(soup.title.string)
9
+# print(soup.prettify())
10
+# print(soup.li)
11
+all_tags = soup.find_all(name="a")
12
+# print(all_tags)
13
14
+for tag in all_tags:
15
+ # print(tag.getText())
16
+ # print(tag.get("href"))
17
+ pass
18
19
+heading = soup.find(name="h1", id="name")
20
+# print(heading)
21
+head1 = soup.find(name="h3", class_="heading")
22
+# print(head1)
23
24
+select = soup.select_one(selector="p a")
25
+select1 = soup.select_one(selector="#name")
26
+# print(select1)
27
28
+headings = soup.select(".heading")
29
+print(heading)
0 commit comments