Привет всем и спасибо за вашу помощь. Я застрял со скребком вложенного стола. Я могу удалить основную таблицу, но когда я нашел строку таблицы, содержащую другие таблицы, я действительно не знаю, как поступить. Вот таблица html:
<tr class="table">
<td class="table" valign="top">
<p class="tbl-cod">0403</p>
</td>
<td class="table" valign="top">
<p class="tbl-txt">Buttermilk, curdled milk and cream, yoghurt, kephir and other fermented or acidified milk and cream, whether or not concentrated or containing added sugar or other sweetening matter or flavoured or containing added fruit, nuts or cocoa</p>
</td>
<td class="table" valign="top">
<p class="tbl-txt">Manufacture in which:</p>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<colgroup><col width="4%">
<col width="96%">
</colgroup><tbody>
<tr>
<td valign="top">
<p class="normal">—</p>
</td>
<td valign="top">
<p class="normal">all the materials of Chapter 4 used are wholly obtained,</p>
</td>
</tr>
</tbody>
</table>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<colgroup><col width="4%">
<col width="96%">
</colgroup><tbody>
<tr>
<td valign="top">
<p class="normal">—</p>
</td>
<td valign="top">
<p class="normal">all the fruit juice (except that of pineapple, lime or grapefruit) of heading 2009 used is originating,</p>
<p class="normal">and</p>
</td>
</tr>
</tbody>
</table>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<colgroup><col width="4%">
<col width="96%">
</colgroup><tbody>
<tr>
<td valign="top">
<p class="normal">—</p>
</td>
<td valign="top">
<p class="normal">the value of all the materials of Chapter 17 used does not exceed 30 % of the ex-works price of the product</p>
</td>
</tr>
</tbody>
</table>
</td>
<td class="table" valign="top">
<p class="normal"> </p>
</td>
</tr>
Я очистил основную таблицу, используя этот код:
with open ('algeriaroo.txt', 'w') as algroo:
for row in RoOtbody.find_all('tr'):
for cell in row.find_all('td'):
algroo.write(cell.text.strip())
algroo.write('\n')
До сих пор я получал этот вид очистки:
0403Buttermilk, curdled milk and cream, yoghurt, kephir and other fermented or acidified milk and cream, whether or not concentrated or containing added sugar or other sweetening matter or flavoured or containing added fruit, nuts or cocoaManufacture in which:
—
all the materials of Chapter 4 used are wholly obtained,
—
all the fruit juice (except that of pineapple, lime or grapefruit) of heading 2009 used is originating,
and
—
the value of all the materials of Chapter 17 used does not exceed 30 % of the ex-works price of the product—all the materials of Chapter 4 used are wholly obtained,—all the fruit juice (except that of pineapple, lime or grapefruit) of heading 2009 used is originating,
and—the value of all the materials of Chapter 17 used does not exceed 30 % of the ex-works price of the product
—all the materials of Chapter 4 used are wholly obtained,
—all the fruit juice (except that of pineapple, lime or grapefruit) of heading 2009 used is originating,
and
—the value of all the materials of Chapter 17 used does not exceed 30 % of the ex-works price of the product
Я бы хотел поцарапать что-то вроде этого:
0403Масло, простокваша, молоко и сливки, йогурт, кефир и другие кисломолочные или кисломолочные продукты и сливки, как концентрированные, так и не содержащие, или с добавлением сахар или другие подслащивающие вещества или ароматизированные или содержащие добавленные фрукты, орехи или какао. Производство, при котором: - все материалы группы 4 получены полностью, - все фруктовые соки (кроме ананасового, лаймового или грейпфрутового) товарной позиции 2009 и - стоимость всех материалов, использованных в главе 17, не превышает 30% от стоимости изделия с завода-изготовителя
Заранее благодарим за помощь!