Non-newline instant output solution for print in Python

Source: Internet
Author: User

About the python2.x and 3.x to bring the print does not break the problem: Yesterday, a tweet, using end = definition, solve the problem of horizontal, but because of the screen display problems, if the string length is too large, it will cause inconvenience. In the case of two or more print partitions, how to maintain the horizontal output, usually with a comma (,) at the end of the print, but at 3.x, it is not possible, you need to use something, some signs like. ; ' also 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: Can see that I put space between "" There'll be something in your screen:just testall the codes was run In Python 3.2,if your write the codes in Pythons 2.x,like python2.7, ################################################# #end 1 = "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,

Non-newline instant output solution for print in Python

Related Article

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.