Advertisement
Guest User

Untitled

a guest
Nov 30th, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. from bs4 import BeautifulSoup
  2.  
  3. src = ""
  4.  
  5. with open("results.htm", 'r') as f:
  6.     src = f.read()
  7.     f.close()
  8.  
  9. soup = BeautifulSoup(src, 'html.parser')
  10.  
  11. front = soup.find("div", {"class":"front"})
  12.  
  13. total_score = 0
  14.  
  15. for f in front:
  16.     i = f.find('div', {'class': 'itemTitle'})
  17.     if i:
  18.         i = i.get('id').split("_")
  19.         score = f.find("input", {"id" : str(i[1]) + "_score"})
  20.         if score: total_score += int(score.get('value'))
  21.  
  22. print total_score
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement