Python print () function

# Output a single data automatically output CRLF 
Print (. 1 )
 Print (2 )
 # output 
. 1 
2 # output newline Print ( ' \ n- ' ) # prevent wrapping for X in Range (0,. 5 ):
     Print (X, = End ' ' ) # output 
01234 # output the entire list 
A = [1,2,3,4,5 ]
 Print (A) # output 
[1, 2, 3, 4, 5 ]
 # formatted output 
= 100 X Print ( '




% D years by You Love the I ' % X) # output the I Love by You 100 years

# control the width accuracy of the output and the PI = 3.141592653 Print ( ' % 10.3f ' % the PI) # field width 10, the accuracy of 3 # output # 3.142

 

Note: print () output will default to the last line of output a carriage return line feed

 

for x in range(0, 5):
    print(x, end=' ')
 
print('\n')  
 
for x in range(0, 5):
    print(x, end=',')
 
'''
0 1 2 3 4 
0,1,2,3,4,
'''

 

Guess you like

Origin www.cnblogs.com/-citywall123/p/11551114.html