如何在Zeppelin中使用Python Pyspark打印粗体,以及使用Zeppelin的Python打印函数进行其他



我在Zeppelin的windows桌面上使用python安装在Linux机器上,并希望在"%pyspark"-单元格。

print('33[1m' + 'Hello' + '33[0m')

在Jupyter的环境中工作,但在齐柏林飞船中,我只得到了一个白色白色背景上的字体,不是粗体。(我可以通过标记看到文本。(

此外,我可能会使用降价语言。但是我必须使用单独的单元格,无法将文本与python组合后果

我还可以试试什么?

在齐柏林飞船中,您可以使用这样的html来获得粗体文本:

print( '%html <b> hello </b>')

你好

只需在第一个引号后以"%html"开头,然后可以使用html语法直到第二个引号。

对于那些还没有使用过很多HTML的人来说,这里有更多HTML基础知识,以及它们如何在%pyspark-Zeppelin单元格中使用:

其他文本样式

print('%html <strong>important</strong>')
print('%html <i>italic</i>')
print('%html <del>striked through</del>')
print('%html <sub>low</sub>')
print('%html <sup>high</sup>')

用于:

重要斜体

删除

以下内容在齐柏林飞船中也同样有效,我现在无法呈现:

print('%html <ins>underlined</ins>')
print('%html <mark>marked</mark>')
print('%html <small>small</small>')

你可以使用h1,h2,。。。,h6表示标题

print('%html <h1>Heading 1</h1>')

标题1

无序或有序列表:

print( '%html <ul>  <li>something</li>  <li>anything</li> </ul>  ')
print( '%html <ol>  <li>first</li>  <li>second</li> </ol>  ')
  • 什么
  • 任何东西
  1. 优先
  2. 第二

链接:

print('%html print <a href="https://www.stackoverflow.com">This is a link to stackoverflow.com</a> ')

这是stackoverflow.com 的链接

将鼠标移到原始单词上时出现的摘要或信息文本

print('%html <p><abbr title="Hypertext Markup Language">HTML</abbr> is the standard markup language for creating web pages and web applications.</p>')

你可以在齐柏林飞船上试试。

文本颜色

例如,基于rgb颜色空间,其中r,g,b是颜色中红色、绿色和蓝色的数量:

print('%html <p style="color:rgb(255, 0, 0);">red</p>')
print('%html <p style="color:rgb(0, 255, 0);">green</p>')
print('%html <p style="color:rgb(0, 0, 255);">blue</p>')

彩色代码的一些示例

你也可以给背景上色:

print('%html <p style="background-color:rgb(255, 0, 0);">Background is red</p>')

最新更新