首页 > 解决方案 > 如何在 jupyter lab 中正确打印 url?

问题描述

这是在 google.com 上搜索关键字 google 的网址:

https://www.google.com/search?q=google&rlz=1C1CHBD_elGR899GR899&oq=google&aqs=chrome..69i57j69i60l4j69i65l2j69i60.1647j0j7&sourceid=chrome&ie=UTF-8

如果我在 jupyter lab 中执行以下单元格,

print("https://www.google.com/search?q=google&rlz=1C1CHBD_elGR899GR899&oq=google&aqs=chrome..69i57j69i60l4j69i65l2j69i60.1647j0j7&sourceid=chrome&ie=UTF-8")

我得到:

https://www.google.com/search?q=google&rlz=1C1CHBD_elGR899GR899&oq=google&aqs=chrome..69i57j69i60l4j69i65l2j69i60.1647j0j7&sourceid=chrome&ie=UTF-8

我怎样才能避免&被显示为&

标签: pythonhtmljupyter

解决方案


我发现这是由 Jupyter 创建可点击链接引起的。例如,如果您在尝试打印的字符串前加上“x”,则不会发生这种情况,并且与号不会被转义。


推荐阅读