继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

python2 与python3的print 差别

ios开发零基础入门
关注TA
已关注
手记 265
粉丝 20
获赞 110

2.x中的print不是个函数,输出格式如下

1 Python 2.7.12+ (default, Aug  4 2016, 20:04:34)
2 [GCC 6.1.1 20160724] on linux2
3 Type "help", "copyright", "credits" or "license" for more information.
4 >>> print "There is only %d %s in the sky."%(1,'sun')
5 There is only 1 sun in the sky.

3.x中的print成了函数,输出格式如下

1 Python 3.5.2+ (default, Aug  5 2016, 08:07:14)
2 [GCC 6.1.1 20160724] on linux
3 Type "help", "copyright", "credits" or "license" for more information.
4 >>> print("There is only %d %s in the sky."%(1,'sun'))
5 There is only 1 sun in the sky.

打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP