Skip to content

Commit 953a38c

Browse files
committed
hi
1 parent 4c18fb5 commit 953a38c

File tree

885 files changed

+136392
-24601
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

885 files changed

+136392
-24601
lines changed

BeautifulSoup4_sample.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
from bs4 import BeautifulSoup
33
import csv
44

5-
page = requests.get('https://www.census.gov/programs-surveys/popest.html')
5+
page = requests.get("https://www.census.gov/programs-surveys/popest.html")
66
print(page.status_code)
7-
soup = BeautifulSoup(page.text, 'html.parser')
7+
soup = BeautifulSoup(page.text, "html.parser")
88
link_set = set()
9-
for link in soup.find_all('a'):
9+
for link in soup.find_all("a"):
1010
web_links = link.get("href")
1111
print(web_links)
1212
link_set.add(web_links)
1313

14-
csvfile = open('code_python.csv', 'w+', newline='')
14+
csvfile = open("code_python.csv", "w+", newline="")
1515
writer = csv.writer(csvfile)
16-
writer.writerow(['Links'])
16+
writer.writerow(["Links"])
1717
for link in link_set:
1818
writer.writerow([link])
1919
csvfile.close()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy