In Python, when the code is long, want to see the code execution result in the Pycharm-console console or Python's own idle shell window, print some characters and so on, there are no line breaks between many lines affecting the viewing effect, so how to print a few lines of space in Python:
Three different ways:
1. Use line break "\ n":
1 Print " \n\n\n " 2 # The result is a 3 blank line
Or:
1 Print ' \ n ' 2 # 3 is three lines.
2. Use print directly, followed by no statements:
1 Print 2 Print 3 Print 4 # The result is a 3 blank line
3.for cycle (more trouble, not recommended)
1 for in range (3):2 print'\ r'
Also, explain the difference between Python2 and Python3:
Python 2.x and 3.x output functions are different due to different versions
Use print output in version 2.x without parentheses using print output blank line
Use the print () output in the 3.x version with parentheses to output blank lines with print ()
Continuous output multiple lines can use the * number syntax
Use print ' \ n ' in the 2.x version #n为行数
Use print (' \ n ' * N) in the 3.x version #n为行数
Demo for version 3.5
1. Print #python2. x version, Python3 write print () to represent a blank line
2, of course, I write print ' \ n ' on behalf of a blank line, print ' \ n ' * 3 for printing three lines blank line
(Python3 version of parentheses, print (' \ n '))
How to print blank lines in Python