I\xe2\x80\x99m 尝试将 df1 中与 df3 中的值匹配的任何字符串的字体颜色更改为红色并突出显示该行。我找不到任何有关更改字体颜色的信息。数据集是:
\n\ndf1 = [ \xe2\x80\x98i like to shop at store a.\xe2\x80\x99 , \xe2\x80\x98he likes to shop at the store b.\xe2\x80\x99, \xe2\x80\x98she is happy to shop at store c.\xe2\x80\x99, \'we want to shop at the store d.\']\ndf2 = [ \xe2\x80\x98store a\xe2\x80\x99, \xe2\x80\x98store b\xe2\x80\x99, \xe2\x80\x98store c\xe2\x80\x99, \'store d\' ]\ndf3 = [ \xe2\x80\x98like to\xe2\x80\x99, \xe2\x80\x98likes to shop\xe2\x80\x99, \xe2\x80\x98at store\xe2\x80\x99 ]\nRun Code Online (Sandbox Code Playgroud)\n\n我正在使用以下内容:
\n\nmyDataSet = list(zip(df1,df2))\ndf = pd.DataFrame(data = myDataSet, columns=[\xe2\x80\x98df1\xe2\x80\x99, \xe2\x80\x98df2\xe2\x80\x99]\nRun Code Online (Sandbox Code Playgroud)\n\n输出应如下所示:
\n\n\n\n请帮忙! …
这是 XML:
<?xml version="1.0" encoding="UTF-8"?>
<file>
<text>
<p>
<sentence>I bought kiwi at the grocery store.</sentence>
<sentence>I also bought bananas at the store.</sentence>
<sentence>Then, I bought a basket at another store.</sentence>
</p>
<p>
<sentence>You bought kiwi at the grocery store.</sentence>
<sentence>You also bought bananas at the store.</sentence>
<sentence>Then, You bought a basket at another store.</sentence>
</p>
</text>
</file>
Run Code Online (Sandbox Code Playgroud)
这是 XSLT:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="sentence">
<p>
<xsl:apply-templates/>
</p>
</xsl:template>
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="file/text/p/sentence[contains(.,$search)]"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)
我需要$search …