Quick solution to print real-time output without line breaks in python

Source: Internet
Author: User
The following small series will bring you a quick solution to print in python with no line breaks and instant output. I think it is quite good. now I will share it with you and give you a reference on Python2.x and 3. print does not wrap caused by x: I sent a tweet yesterday and used end = to solve the small horizontal problem. However, due to the screen display problem, if the string length is too large, this will cause inconvenience. When two or more prints are separated, how to maintain horizontal output is usually followed by a comma (,) at the end of the print, but at 3. otherwise, end = "(something)", some signs like ,.; 'Also you can put a word or str in "".

Example:

############################################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 testAll 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 ,

In this article, the quick solution of print output without line breaks in python is to share all the content with you. I hope to give you a reference and support for the script.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.