Skip to content

Commit 5c28c24

Browse files
Create WebScraping.py
1 parent 8bba34b commit 5c28c24

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

WebScraping.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import requests
2+
from bs4 import BeautifulSoup
3+
4+
# Fetch a web page
5+
page = requests.get("http://www.example.com")
6+
7+
# Parse the HTML content
8+
soup = BeautifulSoup(page.content, "html.parser")
9+
10+
# Find all the links on the page
11+
links = soup.find_all("a")
12+
13+
# Print the links
14+
for link in links:
15+
print(link.get("href"))

0 commit comments

Comments
 (0)