As a developer working on a project for one of my clients in New York, I recently encountered a situation where I needed to display the contents of a list in a clear and readable format. After exploring various methods, I discovered several effective ways to print lists in Python. In this tutorial, I will explain how to print lists in Python with examples.
Python Lists
Before getting into printing lists, let’s quickly recap what lists are in Python. A list is a built-in data structure that allows you to store multiple items in a single variable. Lists are ordered, mutable, and can contain elements of different data types. Here’s an example of a list:
us_cities = ["New York", "Los Angeles", "Chicago", "Houston", "Phoenix"]Read How to Convert a List to a Set in Python?
Print Lists in Python
The simplest way to print a list in Python is by directly passing the list variable to the print() function. For example:
us_cities = ["New York", "Los Angeles", "Chicago", "Houston", "Phoenix"]
print(us_cities)Output:
['New York', 'Los Angeles', 'Chicago', 'Houston', 'Phoenix']You can see the output in the screenshot below.

This method works well for small lists, but the output can become unclear for larger lists or when you need more control over the formatting.
Check out How to Generate a List of Random Numbers in Python?
Use Loops
To print list elements on separate lines or with custom formatting, you can use loops. Python provides two commonly used loops: for loop and while loop in Python.
1. Use a for Loop
A for loop allows you to iterate over each element in a list and print them individually. Here’s an example:
us_states = ["California", "Texas", "Florida", "New York", "Illinois"]
for state in us_states:
print(state)Output:
California
Texas
Florida
New York
IllinoisYou can see the output in the screenshot below.

You can customize the output by adding additional formatting or text within the loop.
Read How to Slice Lists in Python?
2. Use a while Loop
Alternatively, you can use a while loop to print Python list elements. This approach is useful when you need more control over the iteration process. Here’s an example:
us_presidents = ["George Washington", "John Adams", "Thomas Jefferson", "James Madison", "James Monroe"]
index = 0
while index < len(us_presidents):
print(f"{index + 1}. {us_presidents[index]}")
index += 1Output:
1. George Washington
2. John Adams
3. Thomas Jefferson
4. James Madison
5. James MonroeYou can see the output in the screenshot below.

In this example, we use the index variable to keep track of the current position in the list and print the elements along with their corresponding numbers.
Check out How to Concatenate a List of Strings into a Single String in Python?
Advanced Printing Techniques
Python offers several advanced techniques for printing lists that provide more flexibility and formatting options.
1. Use the join() Method
Python join() method allows you to concatenate list elements into a single string, with a specified delimiter. This is particularly useful when you want to print list elements separated by a specific character or string. Here’s an example:
us_tech_companies = ["Apple", "Microsoft", "Amazon", "Google", "Facebook"]
print(", ".join(us_tech_companies))Output:
Apple, Microsoft, Amazon, Google, FacebookYou can see the output in the screenshot below.

In this case, the list elements are joined together using a comma and space as the delimiter.
Check out How to Iterate Through a List Backward in Python?
2. Use List Comprehension
Python list comprehension is a concise way to create new lists based on existing lists. You can use list comprehension to print list elements with custom formatting. Here’s an example:
us_rivers = ["Mississippi", "Missouri", "Colorado", "Ohio", "Columbia"]
[print(f"The {river} River") for river in us_rivers]Output:
The Mississippi River
The Missouri River
The Colorado River
The Ohio River
The Columbia RiverThis code uses list comprehension to print each river name with the added text “The” and “River”.
Read How to Clear a List in Python?
Print Lists with Conditional Filtering
Sometimes, you may want to print only certain elements from a list based on a specific condition. You can achieve this by combining loops and conditional statements. Here’s an example:
us_cities = ["New York", "Los Angeles", "Chicago", "Houston", "Phoenix"]
for city in us_cities:
if len(city) > 7:
print(city)Output:
New York
Los Angeles
Chicago
HoustonIn this example, only the cities with names longer than 7 characters are printed.
Check out How to Check if an Element is Not in a List in Python?
Example
To illustrate the practical application of printing lists in Python, let’s consider a real-world scenario. Suppose you are working on a project that involves analyzing sales data for a US-based company. You have a list of sales figures for different regions, and you need to display the data in a readable format.
sales_data = [
{"region": "Northeast", "sales": 250000},
{"region": "Southeast", "sales": 180000},
{"region": "Midwest", "sales": 220000},
{"region": "West", "sales": 300000}
]
print("Sales Report:")
for entry in sales_data:
region = entry["region"]
sales = entry["sales"]
print(f"{region}: ${sales:,}")Output:
Sales Report:
Northeast: $250,000
Southeast: $180,000
Midwest: $220,000
West: $300,000In this example, we have a list of dictionaries representing sales data for different regions. By iterating over the list and accessing the relevant keys, we can print the sales report in a clear and formatted manner.
Read How to Add Elements to an Empty List in Python?
Conclusion
In this article, I explained how to print lists in Python. I discussed Python and printing lists using loops, such as the for loop and the while loop. Advanced techniques like join(), list comprehension, and conditional filtering. I also gave a real-world example to demonstrate how printing lists can be applied in a practical scenario.
You may like to read:
- How to Divide Each Element in a List by a Number in Python?
- How to Find the Largest Number in a List Using Python?
- How to Remove None Values from a List in 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.