python - 如何使用 Python 打印多行文本

标签 python python-3.x

如果我想在 Python 中打印多行文本而不为每一行输入 print(''),有没有办法做到这一点?

我将它用于 ASCII 艺术。

(Python 3.5.1)

最佳答案

您可以使用 三重 引号(单 ' 或双 "):

a = """
text
text
text
"""

print(a)

关于python - 如何使用 Python 打印多行文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34980251/

相关文章:

python - 在字符串匹配后替换特定字符

python - Windows 7 上的 Pyusb 找不到任何设备

python - 使用 Hadoop Streaming 管理依赖关系?

python - 两个变量大小相同的散点图_实现难度

python-3.x - XCOM 不适用于 PythonVirtualenvOperator airflow 1.10.6

python - 如何使用 python 将 weibull 分布拟合到数据?

python - 从 python 中的 csv 文件数据中删除引号

python pandas 计算数据框中日期范围的小时数

python - 无法从 python subprocess.Popen 启动 make 命令

python - 值错误 : Input arrays should have the same number of samples as target arrays. 找到 166 个输入样本和 4 个目标样本