![图片[1]-python如何打印不换行无空格输出-uusu优素-乐高,模型,3d打印,编程](http://uusucn.zbbe.cn/wp-content/uploads/2024/01/5df97ec6b14e4138.gif)
使用print()函数时,并不希望输出结束后自动换行,因此,我们可以按照下面的方法来做
print()指定结束符
print('hello',end='')
print('world')
#result:helloworld
当print()函数,指定end参数为空字符后,print()函数就不再主动添加换行符了。并且,hello和world之间也不存在任何空格。
a='firstline' b='secondline' c='thirdline' print(a,end='\n\n') print(b) print(c,end='!')原文来自:https://www.py.cn
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
    

















































 
        

暂无评论内容