简体   繁体   中英

How can I print a new line in Colab?

I am using google colab and want to break up a sentence into two lines. I have tried \n and \r, but they do not work.

test = "This is the first line. \r\n This is the second line"
test

This is a link to the code

https://colab.research.google.com/drive/11FhjbT2VvCepdFKSCTVQjYtQfnSxsrTH?usp=sharing

TYZ gave me the answer. print(test) instead of just test.

You can use HTML tags, so you can use <br>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM