-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_0.py
executable file
·95 lines (85 loc) · 2.78 KB
/
example_0.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env python
from pprint import pprint
from HTMLTableParser import HTMLTableParser
# Create the parser
p = HTMLTableParser()
try:
# Create some html data to feed in the parser
myData = """
<html>
<body>
<table id="pricingTable">
<thead>
<tr>
<th class="rowHeader">
Server Sizes:
</th>
<th>
Linux®<span style="font-size:70%; vertical-align: top;">***</span>
<div class="subtitle">Hourly (Estimated Monthly)</div>
</th>
<th>
Windows®
<div class="subtitle">Hourly (Estimated Monthly)</div>
</th>
</tr>
</thead>
<tbody>
<tr>
<td class="rowHeader">
<strong>256</strong>MB RAM
<div class="subtitle"><strong>10</strong>GB Disk</div>
</td>
<td class="highlight">
<strong>$0.015/hr.</strong>
<div class="subtitle">($10.95/mo.)*</div>
</td>
<td>—</td>
</tr>
</tbody>
</table>
<table width="100%" id="anotherPricingTable">
<thead>
<tr>
<th>Plan</th>
<th>Monthly Cost</th>
<th>Server RAM Hours</th>
<th>Effective Hourly Cost</th>
<th>Overage Rate*</th>
<th>Effective Server Cost<br />(per 0.5 GB RAM)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Professional Cloud</td>
<td>$199.00</td>
<td>2500</td>
<td>$0.08</td>
<td>$0.09</td>
<td>$29.90/mo</td>
</tr>
<tr>
<td>Business Cloud</td>
<td>$999.00</td>
<td>14,500</td>
<td>$0.07</td>
<td>$0.08</td>
<td>$25.55/mo</td>
</tr>
<tr>
<td colspan="3"> </td>
<td colspan="3" style="text-align: center; padding-top:10px;">
<a href="www.python.org">Go to Python</a>
</td>
</tr>
</tbody>
</table>
</body>
</html>
"""
# Parse the data
p.feed(myData)
except Exception, e:
print e
# Show results
pprint(p.tables)