Skip to content

Instantly share code, notes, and snippets.

@markroxor
Created April 13, 2019 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markroxor/edf86b5c8ce55fda25593784c477d670 to your computer and use it in GitHub Desktop.
Save markroxor/edf86b5c8ce55fda25593784c477d670 to your computer and use it in GitHub Desktop.
Calculates net usage by Excitel broadband services.
from bs4 import BeautifulSoup
with open('Excitel.htm', 'r') as f:
html = f.read()
parsed_html = BeautifulSoup(html, "lxml")
total_usage = 0
for i, a in enumerate(parsed_html.findAll('table')[0].findAll('td')):
if i % 6 == 4:
usage = float(a.text.split()[0])
total_usage += usage
print('Total usage - ' + '%.2f' % (total_usage / 1024) + 'GB')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment