SlideShare ist ein Scribd-Unternehmen logo
1 von 1
Downloaden Sie, um offline zu lesen
import requests from bs4 import Beauttfutsoup import csv With open ('th_tegistator.csv', 'W',
newtthes''') as ftles wrtter = csv.Wrtter(tte) wrtter.wrtterow(' 'fname', ' 'name', 'ematl', 'phone',
'party', 'dtstr tct','state', 'assembly'1) house_url = 'https://mW.capttol.tn.gov/house/members/'
house_page = requests.get(house_urt) house_soup = BeauttfutSoup(house_page. content, 'html,
parser') house_table = house_soup.ftnd ('table') house_rows = house_table.find_all ('tr') [1:] for
row in house_rows: columns = row.find_all(' td ' ) fname = columns[0]. text.strip() Iname =
columns[1].text.strip() email = columns[2].find(' a ' ) text.strip() phone = columns[3].text.strip()
party = columns[4].text.strip() district = colunns[5]. text.strip() state = 'Tennessee' assembly =
'House' writer.writerow( [' fname', 'Iname' , 'email', 'phone', 'party', 'district','state', 'assegbly'])
senate_url = 'https://Wm. capitol.tn.gov/senate/members/' senate_page = requests.get(senate_url)
senate_soup = BeauttfulSoup(senate_page.content, 'html. parser')
party = cotumns (4, text. strtp() distrtct = columns[5]. text. strtp() state = 'Tennessee' assembly =
'House' writer.writerowil' 'fname', 'Iname', 'ematt', 'phone', 'party', 'dtstrtet', 'state', 'assembly' J)
senate_urt = 'https://WW, capttol.th. gov/senate/members /' senate_page =
requests.get(senate_urt) senate_soup = BeauttfutSoup(senate_page.content, 'htmleparser')
senate_table = senate_soup.f ind( 'table') senate_rows = senate_table.ftnd_atl('tr' )[1:] for row in
senate_rows: columins = row.find_all('td') fnane = columns[0].text.strip() Iname = columns[1]
text.strip() ematl = columns[2].find(' a ') text. strip() phone = columns[3].text.strip() party =
columns [4] text.strip() district = columns[5].text. strip() state = 'Tennessee assembly = 'Senate'
writer.writerow( [' fname', ''name', 'email', 'phone', 'party', 'district', 'state' , 'assembly''])
Traceback (most recent call last): File "main.py", line 13, in

Weitere ähnliche Inhalte

Mehr von watchamirpune

In a recent survey conducted, a random sample of adults 18 ye.pdf
 In a recent survey conducted, a random sample of adults 18 ye.pdf In a recent survey conducted, a random sample of adults 18 ye.pdf
In a recent survey conducted, a random sample of adults 18 ye.pdf
watchamirpune
 

Mehr von watchamirpune (20)

In Arabidopsis, you look at three closely linked traits on chromosome.pdf
 In Arabidopsis, you look at three closely linked traits on chromosome.pdf In Arabidopsis, you look at three closely linked traits on chromosome.pdf
In Arabidopsis, you look at three closely linked traits on chromosome.pdf
 
Imagine that investors expect to receive a compensation of rE=10 for.pdf
 Imagine that investors expect to receive a compensation of rE=10 for.pdf Imagine that investors expect to receive a compensation of rE=10 for.pdf
Imagine that investors expect to receive a compensation of rE=10 for.pdf
 
Image A is best described as A plant cell during prophase An animal.pdf
 Image A is best described as A plant cell during prophase An animal.pdf Image A is best described as A plant cell during prophase An animal.pdf
Image A is best described as A plant cell during prophase An animal.pdf
 
In 1930, the U.S. government attempted to help domestic firms that we.pdf
 In 1930, the U.S. government attempted to help domestic firms that we.pdf In 1930, the U.S. government attempted to help domestic firms that we.pdf
In 1930, the U.S. government attempted to help domestic firms that we.pdf
 
In April 2021, the University Sub Shop had an average check of $7.25 .pdf
 In April 2021, the University Sub Shop had an average check of $7.25 .pdf In April 2021, the University Sub Shop had an average check of $7.25 .pdf
In April 2021, the University Sub Shop had an average check of $7.25 .pdf
 
In 2003 and 2017 a poll asked Democratic voters about their views on .pdf
 In 2003 and 2017 a poll asked Democratic voters about their views on .pdf In 2003 and 2017 a poll asked Democratic voters about their views on .pdf
In 2003 and 2017 a poll asked Democratic voters about their views on .pdf
 
In C++, the function is called at program startup. group start root m.pdf
 In C++, the function is called at program startup. group start root m.pdf In C++, the function is called at program startup. group start root m.pdf
In C++, the function is called at program startup. group start root m.pdf
 
In 199746 of Americans said they did not trust the media when it co.pdf
 In 199746 of Americans said they did not trust the media when it co.pdf In 199746 of Americans said they did not trust the media when it co.pdf
In 199746 of Americans said they did not trust the media when it co.pdf
 
In Canada the proportion of the population is insolvent is 0.3. You.pdf
 In Canada the proportion of the population is insolvent is 0.3. You.pdf In Canada the proportion of the population is insolvent is 0.3. You.pdf
In Canada the proportion of the population is insolvent is 0.3. You.pdf
 
In Australia grassland, the summer time has minimum rainfall no rainf.pdf
 In Australia grassland, the summer time has minimum rainfall no rainf.pdf In Australia grassland, the summer time has minimum rainfall no rainf.pdf
In Australia grassland, the summer time has minimum rainfall no rainf.pdf
 
In an effort to determine the immunoglobulin D (IgD) levels of a cert.pdf
 In an effort to determine the immunoglobulin D (IgD) levels of a cert.pdf In an effort to determine the immunoglobulin D (IgD) levels of a cert.pdf
In an effort to determine the immunoglobulin D (IgD) levels of a cert.pdf
 
In addition, $2,476 was collected for Sandhill Company in August by t.pdf
 In addition, $2,476 was collected for Sandhill Company in August by t.pdf In addition, $2,476 was collected for Sandhill Company in August by t.pdf
In addition, $2,476 was collected for Sandhill Company in August by t.pdf
 
In a recent survey conducted, a random sample of adults 18 ye.pdf
 In a recent survey conducted, a random sample of adults 18 ye.pdf In a recent survey conducted, a random sample of adults 18 ye.pdf
In a recent survey conducted, a random sample of adults 18 ye.pdf
 
III. Simplify the following Boolean functions F, together with the do.pdf
 III. Simplify the following Boolean functions F, together with the do.pdf III. Simplify the following Boolean functions F, together with the do.pdf
III. Simplify the following Boolean functions F, together with the do.pdf
 
In a population distribution, a score of X=54 corresponds to z=2. And.pdf
 In a population distribution, a score of X=54 corresponds to z=2. And.pdf In a population distribution, a score of X=54 corresponds to z=2. And.pdf
In a population distribution, a score of X=54 corresponds to z=2. And.pdf
 
In a Poisson distribution, =3.20. (Round your answers to 4 decimal pl.pdf
 In a Poisson distribution, =3.20. (Round your answers to 4 decimal pl.pdf In a Poisson distribution, =3.20. (Round your answers to 4 decimal pl.pdf
In a Poisson distribution, =3.20. (Round your answers to 4 decimal pl.pdf
 
II. X,Y have joint pdf f(x,y)=cexy,0yx1,Z=X+Y. Find pdf for Z..pdf
 II. X,Y have joint pdf f(x,y)=cexy,0yx1,Z=X+Y. Find pdf for Z..pdf II. X,Y have joint pdf f(x,y)=cexy,0yx1,Z=X+Y. Find pdf for Z..pdf
II. X,Y have joint pdf f(x,y)=cexy,0yx1,Z=X+Y. Find pdf for Z..pdf
 
In a metapopulation, what purposes do source and sink population play.pdf
 In a metapopulation, what purposes do source and sink population play.pdf In a metapopulation, what purposes do source and sink population play.pdf
In a metapopulation, what purposes do source and sink population play.pdf
 
In a hypothetical mouse species, brown fur (B) is completely dominant.pdf
 In a hypothetical mouse species, brown fur (B) is completely dominant.pdf In a hypothetical mouse species, brown fur (B) is completely dominant.pdf
In a hypothetical mouse species, brown fur (B) is completely dominant.pdf
 
In a corpus of N documents, the word the appears in N10 of them. W.pdf
 In a corpus of N documents, the word the appears in N10 of them. W.pdf In a corpus of N documents, the word the appears in N10 of them. W.pdf
In a corpus of N documents, the word the appears in N10 of them. W.pdf
 

Kürzlich hochgeladen

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Kürzlich hochgeladen (20)

Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 

import requests from bs4 import Beauttfutsoup import csv With open (.pdf

  • 1. import requests from bs4 import Beauttfutsoup import csv With open ('th_tegistator.csv', 'W', newtthes''') as ftles wrtter = csv.Wrtter(tte) wrtter.wrtterow(' 'fname', ' 'name', 'ematl', 'phone', 'party', 'dtstr tct','state', 'assembly'1) house_url = 'https://mW.capttol.tn.gov/house/members/' house_page = requests.get(house_urt) house_soup = BeauttfutSoup(house_page. content, 'html, parser') house_table = house_soup.ftnd ('table') house_rows = house_table.find_all ('tr') [1:] for row in house_rows: columns = row.find_all(' td ' ) fname = columns[0]. text.strip() Iname = columns[1].text.strip() email = columns[2].find(' a ' ) text.strip() phone = columns[3].text.strip() party = columns[4].text.strip() district = colunns[5]. text.strip() state = 'Tennessee' assembly = 'House' writer.writerow( [' fname', 'Iname' , 'email', 'phone', 'party', 'district','state', 'assegbly']) senate_url = 'https://Wm. capitol.tn.gov/senate/members/' senate_page = requests.get(senate_url) senate_soup = BeauttfulSoup(senate_page.content, 'html. parser') party = cotumns (4, text. strtp() distrtct = columns[5]. text. strtp() state = 'Tennessee' assembly = 'House' writer.writerowil' 'fname', 'Iname', 'ematt', 'phone', 'party', 'dtstrtet', 'state', 'assembly' J) senate_urt = 'https://WW, capttol.th. gov/senate/members /' senate_page = requests.get(senate_urt) senate_soup = BeauttfutSoup(senate_page.content, 'htmleparser') senate_table = senate_soup.f ind( 'table') senate_rows = senate_table.ftnd_atl('tr' )[1:] for row in senate_rows: columins = row.find_all('td') fnane = columns[0].text.strip() Iname = columns[1] text.strip() ematl = columns[2].find(' a ') text. strip() phone = columns[3].text.strip() party = columns [4] text.strip() district = columns[5].text. strip() state = 'Tennessee assembly = 'Senate' writer.writerow( [' fname', ''name', 'email', 'phone', 'party', 'district', 'state' , 'assembly'']) Traceback (most recent call last): File "main.py", line 13, in