How to properly print a url in jupyter lab?

Viewed 497

This a url for searching the keyword google on google.com:

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

If I execute the following cell in jupyter lab,

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

I get:

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

How can I avoid & being displayed as & ?

1 Answers

I found out this is caused by Jupyter creating a clickable link. If you prefix the string you are trying to print with 'x' for example, it does not happen and the ampersand is not escaped.

Related