这段代码打印出所有的标签:
soup = BeautifulSoup.BeautifulSoup(html)
for child in soup.recursiveChildGenerator():
name = getattr(child, "name", None)
if name is not None:
print name
也可以打印出结束标签吗?
示例:
<html>
<body>
<h1>My First Heading</h1>
<
我刚刚使用li打印了.find_all('li')的所有内容,并且希望在li标记结束后继续打印'p'标记,比如在html开头或中间不打印'p'标记。'p‘标签或最后的剩余标签。请帮帮忙。基本上需要最后的清单-结束标签之后的一切。
from bs4 import BeautifulSoup
html_doc = """\
<html>
<p>
don't need this
</p>
<li>
text i need
</li>
<li>
这是html字符串,我想在pdfmake中打印它。
let html_string = "<html><head></head><body><p>HI</p></body></html>";
//something like this
{ text: html_string,
pageBreak: 'after',
},
它应该作为html内容打印在pdfmake的一部分:如何打印
请查找以下代码:
<?php
use Spiritix\Html2Pdf\Converter;
use Spiritix\Html2Pdf\Input\StringInput;
use Spiritix\Html2Pdf\Output\DownloadOutput;
require_once 'vendor/autoload.php';
$html="<p>This is the Content</p>";
$input = new StringInput();
$input->setHtml($html);
$conver