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()需要您将要输出的内容作为参数传给他。
时间: 2024-10-26 00:59:00