Created
July 25, 2020 22:01
-
-
Save kipronokoech/64ebac45916aabbb9afcf43d50ba5f80 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Next is now to loop though the rest of the rows | |
#print(body_rows[0]) | |
all_rows = [] # will be a list for list for all rows | |
for row_num in range(len(body_rows)): # A row at a time | |
row = [] # this will old entries for one row | |
for row_item in body_rows[row_num].find_all("td"): #loop through all row entries | |
# row_item.text removes the tags from the entries | |
# the following regex is to remove \xa0 and \n and comma from row_item.text | |
# xa0 encodes the flag, \n is the newline and comma separates thousands in numbers | |
aa = re.sub("(\xa0)|(\n)|,","",row_item.text) | |
#append aa to row - note one row entry is being appended | |
row.append(aa) | |
# append one row to all_rows | |
all_rows.append(row) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment