This file looks large and may slow your browser down if we attempt
to syntax highlight it, so we are showing it without any
pretty colors.
Highlight
it anyway.
| 1 |
from BeautifulSoup import BeautifulSoup |
| 2 |
|
| 3 |
soup = BeautifulSoup(open('07369685000197.result')) |
| 4 |
|
| 5 |
rows = soup.findAll('tr') |
| 6 |
# 0: Empty |
| 7 |
# 1: Donator name |
| 8 |
# 2: Empty |
| 9 |
# 3: Donator CNPJ |
| 10 |
# 4: Empty |
| 11 |
# 5: Date |
| 12 |
# 6: Empty |
| 13 |
# 7: Donation Value |
| 14 |
# 8: Empty |
| 15 |
# 9: Resource type |
| 16 |
# 10: Empty |
| 17 |
# 11: Transfer type |
| 18 |
# 12: Empty |
| 19 |
# 13: Name |
| 20 |
# 14: Empty |
| 21 |
# 15: Candidate number |
| 22 |
# 16: Empty |
| 23 |
# 17: Party |
| 24 |
# 18: Empty |
| 25 |
# 19: Position |
| 26 |
# 20: Empty |
| 27 |
# 21: City |
| 28 |
# 22: Empty |
| 29 |
# 23: |
| 30 |
for data in rows[2:]: |
| 31 |
if len(data.contents) < 13: |
| 32 |
continue |
| 33 |
|
| 34 |
print unicode(data.contents[13].contents[2]).strip() |