如何实现这个?我希望链接在 markdown 单元格中。
对于视觉学习者:
[blue_text](url_here)
如果它不是一个Markdown单元格,那就是我所使用的:
from IPython.core.display import display, HTML
display(HTML("""<a href="https://google.at">text</a>"""))
%%html
后面不要加空格。在 </a>
闭合标签之后的 >
后面,你可以添加可见的超链接文本:<a href="your_url_here">可点击的文本</a>
。还有,点个赞。 - calocedrus当我想在Python笔记本的Markdown单元格中插入网页链接时,以下是我使用的代码:
[Clickable_visible_hyperlink](Hidden_landing_URL)
from IPython.display import display, Markdown
display(Markdown("[google](https://www.google.com)"))
我也尝试过
display(HTML("""<a href="https://www.google.com>google</a>"""))
第三步,还包括一行代码示例(也用于笔记本电脑的Markdown单元格)以在Markdown单元格中创建彩色文本。在这行代码中,双##字符导致使用Jupyter中第二大的字体。使用更多这些字符的较小文本-####为最小。一个#会产生输出中最大的字体。
最后,确保关闭并运行Markdown单元格以查看输出。下面是Markdown单元格的代码,更进一步展示了笔记本电脑的输出。
Markdown单元格中的代码:
"https://www.tensorflow.org/images/colab_logo_32px.png" # link to website
<img src="tidyflow.png" /> # The image file (This path is the same folder as Notebook file)
## <font color = cyan> Some Colored Text in Notebook Markdown Cell </font> # colored text
输出:
import random
name = input("what is your name ?")
print("Good Luck !", name)
words = ['Rainbow','Computer','Science','Programming',
'Python','C++']
word = random.choice(words)
print("Guess The Characters")
guesses = ''
turns = 12
while turns > 0:
failed = 0
for char in word:
if char in guesses:
print(char, end=" ")
else:
print("_")
failed += 1
if failed == 0:
print("You Win")
guess = input("guess a character:")
guesses += guess
if guess not in word:
turns -= 1
print("wrong")
print("You Have", +turns, 'more guesses')
if turns == 0:
print("You Loose")