days = "Mon Tue Wed Thu Fri Sat Sun" months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"
\n 表示回车 就是新一行
\\表示一个反斜杠符号--转义序列 print "Here are the days: ", days # print语句和显示的变量之间有“,”号 exercise3中也有类似语句,但没注意过 print "Here are the months: ", months print """ There's something going on here. With the three double-quotes. We'll be able to type as much as we like. Even 4 lines if we want, or 5, or 6. """
# 三个双引号表示可以显示多行
本文介绍了如何使用Python打印包含多行的字符串及特殊字符。通过具体代码示例展示了如何利用转义序列实现换行及显示反斜杠符号,并且解释了如何通过三个双引号来创建多行字符串。
372

被折叠的 条评论
为什么被折叠?



