系统:mac os 10.14
Python: 2.7.10
版本:《笨办法学Python》(第四版)
基本习题
1. 完成基本习题
(1) 根据题目,编辑以下内容:
# Here's some new strange stuff, remember type it exactly.
days = "Mon Tue Wed Tue Fri Sat Sun"
months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"
print "Here are the days: ", days
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.
"""
输出结果如图所示:

本文分享了在macos10.14环境下使用Python2.7.10进行编程的基本习题解答过程,包括字符串操作和打印格式的详细示例。作者通过具体代码演示了如何处理特殊字符和多行字符串,旨在帮助读者掌握Python基础语法。
695

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



