Currently have this code and it's storing every td into a JSON file but I want it filtered into 4 tags:
find_table = soup.find("table", id="viewAllSeriesTable")
rows = find_table.select("td")
with open("data_file.json", "w") as write_file:
data = [j.get_text(strip=True) for j in rows]
json.dump(data, write_file)
HTML Code:
<table width="735" cellpadding="0" cellspacing="2" border="0"
id="viewAllSeriesTable">
<thead>
<tr>
<th id="id">Series ID</th>
<th
id="seriesName">Series Name</th>
<th id="clientName">Client Name</th>
<th id="Brand">Brand</th>
</tr>
</thead>
<tbody>
<tr>
<td id="9127"
style="word-break: break-word;"><a
href="seriesDefinition.html?id=9127">9127</a></td>
<td
style="word-break: break-word;">a</td>
<td style="word-break:
break-word;">A</td>
<td style="word-break: break-word;">B</td>
</tr>
How would I be able to do this?
{
"id": 9127,
"seriesName": "a",
"clientName": "A",
"Brand": "B"
},