我有一个应用程序,呈现HTML和我希望添加一个查找功能,将包装在跨标签,使我可以样式他们的任何匹配。你知道吗
html = """
<html>
<h1>hello world</h1>
<p>This is text to display</p>
</html>
"""
match = "h"
match变量中的字符串应为任意长度。你知道吗
注意:我不想匹配标签中出现的任何“h”字符。你知道吗
我愿意用靓汤或其他图书馆。你知道吗
我的HTML:
<html>
<h1>
Kraken-MD
</h1>
<br/>
<hr/>
<br/>
View markdown on your computer with ease, launch Kraken MD from command line or open a file!
<br/>
<blockquote>
<span style="color: grey; background-color: grey;">
|
</span>
<b>
Note:
</b>
Only basic markdown capability is present, if you wish to render more advanced markdown, download another renderer, this program is a work in progress and is
<i>
not
</i>
yet fully capable. Updates are being worked on.
</blockquote>
<br/>
<br/>
<i>
Kraken MD
</i>
is a markdown renderer for the Windows operating system. Its purpose is to display formatted markdown.
<br/>
<br/>
To begin, open Kraken MD and go to
<span style="color: maroon;">
<code>
File > Open
</code>
</span>
or press CTRL+O and select a
<span style="color: maroon;">
<code>
.md
</code>
</span>
file. Your file will be displayed in the window.
<br/>
<br/>
You can also open a file immediately via the command line. Simply enter
<span style="color: maroon;">
<code>
python index.py
<filepath>
</filepath>
</code>
</span>
where
<span style="color: maroon;">
<code>
<filepath>
</filepath>
</code>
</span>
is an absolute or relative path to the file.
<br/>
<br/>
To run an unbuilt version, you must have installed:
<br/>
<ul>
<li>
wxPython
<span style="color: maroon;">
<code>
($ pip install -U wxPython)
</code>
</span>
</li>
</ul>
<br/>
<ul>
<li>
beautifulSoup
<span style="color: maroon;">
<code>
($ pip install beautifulsoup4)
</code>
</span>
</li>
</ul>
<br/>
<ul>
<li>
<a href="https://www.python.org/ftp/python/3.6.5/python-3.6.5.exe" style="color:maroon;" target="_blank">
python 3.6+
</a>
</li>
</ul>
<br/>
</html>
如果要在HTML中查找并设置包含
match
字符的某些单词的样式,则可以创建修饰符并使用re
:输出:
span_class
的目标是,在HTML中,您可以稍后应用css
样式类:相关问题 更多 >
编程相关推荐