How to make two print in Python () function to print the output on one line?

1. two successive print () function Why content will be displayed in the output branch?

Solution: print () There are two default parameters sep and End, which is the place sep delimiter, end in place of the end of line breaks, default ',' instead of spaces, and the default end of line feed character, end function is used a line output end of the definition

= coffee_cup 'Coffee'  
Print ( "the I Love My", coffee_cup,, End = "End_flag is" "!")  
"" "
The output is:
! End_flag is the I Love My Coffee
" ""

2. How to make two print () function prints one line
 solution: You can use end parameters, the default line breaks or blank spaces to be changed

 

#__coding:utf-8__

#注释:打印在一行使用end=''
print("hello world.",end = " ")
print("this is one programmer.",end = ' ')
print("i like this ")

#打印9*9
for i in range(1,10):
    for j in range(1,i+1):
        if j<i:
            print(i,'*',j,'=',i*j,end='  ')
        else:
            print(i,'*',j,'=',i*j)
        
    #print('\n')

 

 

Guess you like

Origin www.cnblogs.com/lisa2016/p/11574191.html