首页 > 编程语言 > 详细

python_day1学习笔记

时间:2016-05-15 14:04:54      阅读:260      评论:0      收藏:0      [点我收藏+]

一、Python 2.7.x 和 3.x 版本的区别小结

  •  print函数

1、python2

1 import platform
2 
3 print ‘Python’, platform.python_version()
4 print ‘Hello, World!’
5 print(“Hello,World!’)
6 print "text", ; print print more text on the same line
输出结果:
1
Python 2.7.6 2 Hello, World! 3 Hello, World! 4 text print more text on the same line

2、python3

1 import platform
2 
3 print(Python, platform.python_version())
4 print(Hello, World!)
5 
6 print("some text,", end="") 
7 print( print more text on the same line)
结果输出:
1 Python 3.5.1
2 Hello, World!
3 some text, print more text on the same line
1 >>> print Hello,World!
2   File "<stdin>", line 1
3     print Hello,World!
4                        ^
5 SyntaxError: Missing parentheses in call to print

 

 

二、用户输入及输出

 

 

三、while循环

 

python_day1学习笔记

原文:http://www.cnblogs.com/yinjia/p/5495090.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!