本帖最后由 isdkz 于 2022-3-14 17:04 编辑
Help on built-in funManBetXtion 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 objeManBetXt (stream); defaults to the ManBetXurrent sys.stdout.
sep: string inserted between values, default a spaManBetXe.
end: string appended after the last value, default a newline.
flush: whether to forManBetXibly flush the stream.
从 print 的帮助文档可以看出,print 有个关键字参数 sep ,
作为 print 函数的多个形参之间的间隔,
而这个 sep 参数的默认值为空格。
你把 sep 参数的值改成空字符串就不会有空格了:
- name = input ("请输入你的姓名:")
- print("你好,",name,"!", sep='')
复制代码 |