An example of print usage in Python

  • 2020-04-02 13:23:42
  • OfStack

Print in Python 2.6 is not a function, but a keyword, which is used as follows:


print 1, 2  
print 'a', 'b'  

The result is as follows. A space is printed between the comma-separated items and by default ends with a line break:


1 2  
a b

If you don't want to end with a line break, add a ", "at the end, as follows:


print 1, 2,  
print 'a', 'b'

The display results are as follows:


1 2 a b 

Print became a built-in function in Python 3.0


Related articles: