|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
print('您好',name,sep=',',end='!')和print('您好',',',name,end='!')
为什么最终print时,中间的,间隔会变得不一样?
>>> 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.
===============以上是函数帮助文档,函数默认sep为空格===========
也就是说print()函数默认的间隔是空格,多个参数之间默认用空格隔开
你第一个方法设置sep为空
第2个没有设置,所以默认用空格隔开,并且逗号也作为了一个参数传入,自然不一样了
|
|