When I first started coding in Python, one of the simplest things I needed was to skip a line in my output. It may sound simple, but when you are formatting reports, working with text files, or cleaning large datasets, being able to skip lines can make your code much more readable and your output well-structured.
I have used different methods to skip lines in Python. Sometimes I just needed to add a blank line in the console output. Other times, I had to skip a line while reading from a file or while processing a dataset where certain rows were not useful.
In this tutorial, I will walk you through the different ways you can skip a line in Python. Each method comes from real-world situations I’ve faced, and I’ll explain them step by step so you can apply them in your own projects.
Method 1: Use Python If Statement
In this section, I will explain how to skip a line using an if statement in Python. The if statement is a conditional statement in Python and works if the statement is True.
USA_cities = ['Dallas', 'Los Angeles', 'New York', 'Chicago']
for i in USA_cities:
if i=='New York':
print()
print(i)Output:
Dallas
Los Angeles
New York
ChicagoYou can refer to the screenshot below to see the output.

Using an if statement, you can easily skip printing a specific line in Python when a condition is met.
Method 2: Use \n (Newline character)
In Python, a newline character (\n) indicates the end of the line. So, we can put the \n in the text to skip a line. This is the most common way to skip lines in Python.
print("Sucess is a Journey\nNot a Destination")Output:
Sucess is a Journey
Not a DestinationYou can refer to the screenshot below to see the output.

Using the newline character \n, you can easily insert line breaks and skip to a new line in Python output.
Method 3: Use Pass Statement
One of the simplest ways to skip a line in Python is by using the pass statement, which acts as a placeholder. It allows you to bypass a code line without causing any Python SyntaxError.
Here is the complete code to skip a line using a pass statement in Python.
Employee_Name = ['John', 'Lynne', 'Alex', 'Ellena', 'Joe', 'Jonny']
for i in Employee_Name:
if (i=='Alex'):
pass
else:
print(i)Output:
John
Lynne
Ellena
Joe
JonnyYou can refer to the screenshot below to see the output.

The pass statement lets you skip executing specific lines in Python loops without causing any errors.
Method 4: Use the Return Statement
This is another approach to skipping a line in Python using the return statement in a function. Here is the complete Python code.
def USA_car_brands(x):
if (x == "Cadillac"):
return
else:
print(x)
return
car_brands = ["GMC", "Tesala", "Cadillac", "Ford", "Cadillac", "Jeep" ]
for i in car_brands:
USA_car_brands(i)Here, I have given input to the function: Cadillac, which skips printing that particular brand and returns from the Python function without taking any further action. For any other car brand, it prints the brand name.
if (x == "Cadillac"):
return
else:
print(x)
returnYou can refer to the screenshot below to see the output.

The return statement can be used inside a function to skip specific inputs and exit early without executing further code.
Method 5: Use the Continue Statement
The continue statement in Python is used to skip the remaining code inside a loop for the current iteration only.
We use the ‘continue’ statement to skip the execution of the current iteration of the loop. To avoid error, do not use this statement outside the loop. This may cause an error in Python.
for val in "California":
if val == "i":
continue
print(val)Output:
C
a
l
f
o
r
n
aYou can refer to the screenshot below to see the output.

The continue statement skips the current iteration in a loop and moves to the next one without executing the remaining code.
In my projects, I often start with the simple print() method for console formatting. When working with files, I rely on condition checks and continue to skip unnecessary lines. And when building strings, I use \n for precise control.
Now that you’ve seen these different approaches, you can choose the one that fits your specific use case. Try them out in your projects, and you’ll notice how much cleaner and more manageable your code becomes.
You may also read:
- Rename Files in Python
- Check if a File is Empty in Python
- Get File Name Without Extension in Python
- List Files in a Directory with Python

I am Bijay Kumar, a Microsoft MVP in SharePoint. Apart from SharePoint, I started working on Python, Machine learning, and artificial intelligence for the last 5 years. During this time I got expertise in various Python libraries also like Tkinter, Pandas, NumPy, Turtle, Django, Matplotlib, Tensorflow, Scipy, Scikit-Learn, etc… for various clients in the United States, Canada, the United Kingdom, Australia, New Zealand, etc. Check out my profile.