首页 > 文章列表 > python多行代码如何录入

python多行代码如何录入

python多行代码
196 2022-08-07

说明

1、>>>后面输入第一行代码,敲击回车,出现“…”。

2、继续输入后面的第二行代码。还可复制多行代码,在>>>处点击右键粘贴。

实例

>>> print('''Beautiful is better than ugly.
... Explicit is better than implicit.
... Simple is better than complex.
... Complex is better than complicated.''')

使用三引号可以表示多行字符串。

本文教程操作环境:windows7系统、Python 3.9.1,DELL G3电脑。