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

Python之路Python3【第零篇】Python2 & Python3区别持续更新~

时间:2016-05-13 23:14:28      阅读:282      评论:0      收藏:0      [点我收藏+]

标签:

print

def print(self, *args, sep= , end=\n, file=None): # known special case of print
    """
    print(value, ..., sep=‘ ‘, end=‘\n‘, file=sys.stdout, flush=False)
    
    Prints the values to a stream, or to sys.stdout by default.
    Optional keyword arguments:
    file:  a file-like object (stream); defaults to the current sys.stdout.
    sep:   string inserted between values, default a space.
    end:   string appended after the last value, default a newline.
    flush: whether to forcibly flush the stream.
    """
    pass

Python2中print是一个语句,只需要向吧输出的放在print关键字后面就可以输出。

Python3中从上面的代码中可以看出他现在是一个函数,就像其他函数一样,print()需要您将要输出的内容作为参数传给他。

 

Python之路Python3【第零篇】Python2 & Python3区别持续更新~

标签:

原文地址:http://www.cnblogs.com/luotianshuai/p/5475959.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!