python学习记录 - python3.x中如何实现print不换行

it2022-05-09  36

python3.x中如何实现print不换行

 

大家应该知道python中print之后是默认换行的,

那如何我们不想换行,且不想讲输出内容用一个print函数输出时,就需要改变print默认换行的属性,

方法如下:

print('contents', end='!@#$%^&*')

end就表示print将如何结束,默认为end="\n"(换行)

栗子:

print("祝各位身体健康")

print("!")

 

print("祝各位身体健康", end=' ')

print("!")

转载于:https://www.cnblogs.com/taoke2016/p/7468907.html

相关资源:数据结构—成绩单生成器

最新回复(0)