首页 > 程序开发 > Web开发 > Python >

Learn Python The Hard Way学习(9) - 打印,打印,打印

2012-06-21

[python]1.# -- coding: utf-8 --2.# 下面这些代码比较特殊,保证输入准确3.4.5.days = "Mon Tue Wed Thu Fri Sat Sun"6.months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"7.8.9.print "Here ...

[python]
1. # -- coding: utf-8 --
2. # 下面这些代码比较特殊,保证输入准确
3.
4.
5. days = "Mon Tue Wed Thu Fri Sat Sun"
6. months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"
7.
8.
9. print "Here are the days: ", days
10. print "Here are the months: ", months
11.
12.
13. print """
14. There's something going on here.
15. With the three double-quotes.
16. We'll be able to type as much as we like.
17. Even 4 lines if we want, or 5, or 6.
18. """

运行结果:
Here are the days: Mon Tue Wed Thu Fri Sat Sun
Here are the months: Jan
Feb
Mar
Apr
May
Jun
Jul
Aug

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.

root@he-desktop:~/mystuff#

加分练习
1. 记录错误,保证不再出错。

作者:lixiang0522

相关文章
最新文章
热点推荐