Ham*_*FzM 1 python printing text python-3.x
我想在python之前打印的另一个文本旁边打印一些文本
print("Hello")
a="This is a test"
print(a)
Run Code Online (Sandbox Code Playgroud)
我的意思是打印像这样的"HelloThis是一个测试"不在下一行我知道我应该使用print("Hello",a)但我想使用分离的打印命令!!!!
使用end=''在第一个print电话:
print("Hello", end='')
a = "This is a test"
print(a)
#HelloThis is a test
Run Code Online (Sandbox Code Playgroud)
帮助print:
print(value, ..., sep=' ', end='\n', file=sys.stdout)
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.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
354 次 |
| 最近记录: |