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


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区别持续更新~

相关内容

    暂无相关文章

评论关闭