Python cross-line print: Multi-use (), line break \ To be careful, use less + or no (other program code across the line with \ On the line, cannot use parentheses)

Source: Internet
Author: User

Both of these are wrong.

# print ' 11 '
# ' Tset3 ' #error
# print ' 12 '

# + ' Tset4 ' #error

The following test code contains the basic possible scenarios

‘‘‘

@author: Willard
‘‘‘
print ' 1 ' + "Tset"
print ' 2 ' "Tset1"
Print (' 3 '
"Tset1")
Print (' 4 ',
' Tset1 ')

print ' 5 '
"Tset1"
print ' 5 ' \
' Tset2 '
print ' 5 ' \
' Tset3 '

print ' 6 ' +\
"Tset"
print ' 7 ' +\
"Tset"

print ' 8 ' \
+ "Tset"
print ' 9 ' \
+ "Tset"

print ' 10\
Tset1 '
print ' 10\

Tset2 '


The output is:

1tset
2tset1
3tset1
(' 4 ', ' Tset1 ')
5
5tset2
5tset3
6tset
7tset
8tset
9tset
10tset1
Ten Tset2




Python cross-line print: Multi-use (), line break \ To be careful, use less + or no (other program code cross the line with \ On the line, cannot use parentheses)

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.