Home >Backend Development >Python Tutorial >A quick solution to immediate output without line breaks in python
Regarding the problem of print not wrapping caused by Python2. , it will cause inconvenience. When two or more prints are divided, how to maintain horizontal output? Generally, a comma (,) is added to the end of the print. However, under 3.x, this does not work. You need to use end = "(something)", some signs like , . ; 'also you can put a word or str in"".
############################################ end1 = "j" end2 = "u" end3 = "s" end4 = "t" end5 = "t" end6 = "e" end7 = "s" end8 = "t" print(end1 + end2 + end3 + end4,end = " ") print(end5 + end6 + end7 + end8) ############################################ Explain: You can see that i put space between"" There will be something in your screen: just test All the codes was run in python 3.2,if you write the codes in pythons 2.x,like python2.7, ################################################## end1 = "j" end2 = "u" end3 = "s" end4 = "t" end5 = "t" end6 = "e" end7 = "s" end8 = "t" print(end1 + end2 + end3 + end4,) print(end5 + end6 + end7 + end8) ################################################# that's all,in python 2.x so the differences is: 3.2 end = " " 2.7 ,
The above quick solution for instant output without line breaks in print in Python is all the content shared by the editor. I hope it can give you a reference, and I hope you will support Script Home.