在Python中,换行可以通过以下两种方式实现:
1. 使用转义字符 `\n`:
print("Hello\nWorld")
输出将会是:
Hello
World
2. 使用 `Enter` 键:
在代码编辑器中,在一行末尾按下 `Enter` 键也会创建一个新行。
def example_function():
print("This is a line.")
print("This is another line.")
以上两种方法都可以在Python中实现换行