python輸出連在一起的方法:
使用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='!')
以上內容為大家介紹了python輸出怎么連在一起,希望對大家有所幫助,如果想要了解更多Python相關知識,請關注IT培訓機構:千鋒教育。