码迷,mamicode.com
首页 > 编程语言 > 详细

python_day1学习笔记

时间:2016-05-15 14:07:31      阅读:208      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!