在Python中,可以使用換行符"\n"來實現輸出結果的自動換行??梢酝ㄟ^在字符串中插入"\n"或者使用print函數來實現。
例子1:在字符串中插入換行符
print("Hello\nWorld")
輸出結果:
Hello World
例子2:使用print函數輸出多行文本
print("Hello") print("World")