python里有两种在字符串内部换行的方式(使用一个print打印多行字符串)。
首先使用\n的方法大家肯定都知道了。
然后是使用 ''' 三个单引号大方法。
在交互式命令行里输入print('''line1回车后光标会自动跳转到下一行,并且提示符由>变为...在这之后继续输入下一行的内容即可。内容输入完毕之后结尾加上''')再回车就OK啦!

在编译器里编程序的时候,和命令行里类似,只是不会出现提示符而已。

输出为:

以上这篇python中的字符串内部换行方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。