当前位置:编程学习 > python >>

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

[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

补充:Web开发 , Python ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,