springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2022-10-19 13:13:06
244
我对HTML和解析非常陌生,所以如果我使用了错误的术语,我很抱歉。我之前问过一个类似的问题,并找到了一些有用的答案。下面的HTML代码片段包含两个表和两个表头(以及更多行,但与本文无关)
<body>
<table>
<tr class="header">
<th><strong>Heading 1</strong></th>
<th><strong>Heading 2</strong></th>
<th><strong>Heading 3</strong></th>
<th><p><strong>Heading 4, line 1</strong></p>
<p><strong>Heading 4, line 2</strong></p></th>
</tr>
<tr>
<!--Many more rows-->>
</tr>
</table>
<table>
<tr class="header">
<th><strong>Diff Header 1</strong></th>
<th><strong>Diff Header 2</strong></th>
<th><strong>Diff Header 3</strong></th>
<th><p><strong>Diff Header 4, line 1</strong></p>
<p><strong>Diff Header 4, line 2</strong></p></th>
</tr>
<tr>
<!--Many more rows-->>
</tr>
</table>
</body>
我正在尝试使用Python3.6和BeautifulSoup4来解析它,并将文本提取到a列表中。我的问题是,我希望每个块都有单独的列表。我当前的代码似乎搜索并找到了所有标记,而不是第一个表中的标记。
以下是我所拥有的:
<body>
<table>
<tr class="header">
<th><strong>Heading 1</strong></th>
<th><strong>Heading 2</strong></th>
<th><strong>Heading 3</strong></th>
<th><p><strong>Heading 4, line 1</strong></p>
<p><strong>Heading 4, line 2</strong></p></th>
</tr>
<tr>
<!--Many more rows-->>
</tr>
</table>
<table>
<tr class="header">
<th><strong>Diff Header 1</strong></th>
<th><strong>Diff Header 2</strong></th>
<th><strong>Diff Header 3</strong></th>
<th><p><strong>Diff Header 4, line 1</strong></p>
<p><strong>Diff Header 4, line 2</strong></p></th>
</tr>
<tr>
<!--Many more rows-->>
</tr>
</table>
</body>
问题:如何修改此代码,使其只查找当前行中的标记,而不是每行中的标记?
谢谢您的帮助!
顺晟科技:
使用代替。
如果您的HTML片段来自问题:
打印:
05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11