Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- from bs4 import BeautifulSoup
- def main():
- url = "https://docs.google.com/spreadsheets/d/1TZKeP3gg8jC8gN9wducYUKNEuWd-ETUWIcfgsg9mqik/pubhtml/sheet?headers\x3dfalse&gid=1024335575"
- r = requests.get(url)
- html = r.content
- soup = BeautifulSoup(html, "html.parser")
- table = soup.find_all("td")
- dataList = list()
- candidateList = list()
- percentageList = list()
- for row in table:
- if(row.text!=""):
- dataList.append(row.text)
- for i in range(6, 24, 4):
- candidateList.append(dataList[i])
- for i in range(8, 28, 4):
- percentageList.append(dataList[i])
- for i in [3, 1, 2, 0, 4]:
- print(candidateList[i] + ": " + percentageList[i])
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement