'Python Insert Table tags to XML file
I'm still learning Python and needing your help with the problem below:
So I have parsed all tables in an HTML file using BeautifulSoup with these codes (2 tables found):
with open(regtext_sample_nh10121a.html) as f: contents = f.read() soup = BeautifulSoup(contents, 'lxml') tbl = []
for tag in soup(): for attribute in ["cellspacing", "style", "class", "colspan", "rowspan"]: del tag[attribute] tables = soup.findAll("table")
So, I wanted the both tables to be inserted on an XML file right after the closing of p tags. (see screenshot)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
