print()函数
python2.x,print是个关键字,不是函数。
python3.x,print() 函数用于打印输出。
>>> print("hello world!")
hello world!
>>> help(print)
Help on built-in function print in module builtins:
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.
关键:print()函数默认以一个空格间隔多个对象,默认结尾自动换行,也可以改成其他字符串。
设置不同符号分割或者结尾:
>>> print('hello world!',end=' ')#不换行,以为空格结尾
hello world! >>>
>>