Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Python Tutorial
  • Interview Questions
  • Python Quiz
  • Python Glossary
  • Python Projects
  • Practice Python
  • Data Science With Python
  • Python Web Dev
  • DSA with Python
  • Python OOPs
Open In App
Next Article:
Python end parameter in print()
Next article icon

Print lists in Python

Last Updated : 08 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Printing a list in Python is a common task when we need to visualize the items in the list. There are several methods to achieve this and each is suitable for different situations. In this article we explore these methods.

The simplest way of printing a list is directly with the print() function:

Python
a = [1, 2, 3, 4, 5] print(a) 

Output
[1, 2, 3, 4, 5] 

Note: This method prints the raw Python list syntax (as a single object), including the brackets and commas.

If we want a more cleaner or customized output format then please follow the below discussed approach.

Using print() with * operator

We can use print(*list_name) when we want a simple and clean display of list elements without additional formatting like brackets or commas. The * operator unpacks the list so that each element is printed individually.

Python
a = [1, 2, 3, 4, 5]  # Print without using any separators # between elements print(*a)  # Print using separator (,) print(*a, sep =', ') 

Output
1 2 3 4 5 1, 2, 3, 4, 5 

Explanation: The * operator unpacks the list and pass its elements as separate arguments to print(). By using sep, we can specify custom separators such as (,).

Using a Loop

We can use a loop (for loop) to iterate over each elements of the list and print it. This approach provides complete control over how each element is printed.

Python
a = [1, 2, 3, 4, 5]  # Iterate over each element of list for val in a:     print(val, end=' ') 

Output
1 2 3 4 5 

Explanation: The end=’ ‘ ensures that each element is printed on the same line separated by a space.

Using .join()

If we have a list of strings and we want to print our list as a string where all elements are neatly joined together with a specific separator (e.g., commas or hyphens) then we can use .join() to achieve this. This method works best when print list of strings.

Python
a = ["Geeks", "for", "Geeks"] print(' '.join(a)) 

Output
Geeks for Geeks 

Using map() with .join()

If our list contains mixed data types (like integers and strings) then we need to convert each element to a string before joining them. By using map(), we can efficiently apply the conversion to every item in the list in a clear and simple manner.

Python
a = [1, 2, 3, 4, 5] print(' '.join(map(str, a))) 

Output
1 2 3 4 5 

Explanation: The map() function applies str() to each element, allowing easy conversion for join().

Which method to choose?

  • print(*lst): Clean, simple, bracket-free output.
  • .join(): For formatted output of list of string elements.
  • for loop: Full control over iteration and custom formatting.
  • map() with .join(): Handles mixed types for formatted output.
  • print(lst): Best for debugging, shows list with brackets.


Next Article
Python end parameter in print()

S

Striver
Improve
Article Tags :
  • Python
  • python-list
Practice Tags :
  • python
  • python-list

Similar Reads

  • Multi-Line printing in Python
    We have already seen the basic use of print function previous article. Now, let's see how to use print function for multi-line printing. This can easily be done using multiline string i.e. three single quotes ''' Geeksforgeeks ''' . Let's see different examples to see the demonstration for the same.
    1 min read
  • Python List of Lists
    A list of lists in Python is a collection where each item is another list, allowing for multi-dimensional data storage. We access elements using two indices: one for the outer list and one for the inner list. In this article, we will explain the concept of Lists of Lists in Python, including various
    3 min read
  • Python print() function
    The python print() function as the name suggests is used to print a python object(s) in Python as standard output. Syntax: print(object(s), sep, end, file, flush) Parameters: Object(s): It can be any python object(s) like string, list, tuple, etc. But before printing all objects get converted into s
    2 min read
  • Python Print Exception
    In Python, exceptions are errors that occur at runtime and can crash your program if not handled. While catching exceptions is important, printing them helps us understand what went wrong and where. In this article, we'll focus on different ways to print exceptions. Using as keywordas keyword lets u
    3 min read
  • Python end parameter in print()
    In Python, the print() function, commonly used for displaying output, by default ends each statement with a newline character (\n), but this behavior can be customized using the end parameter, which allows you to specify a different string (such as a space, comma, or hyphen) to be printed at the end
    3 min read
  • Python | sep parameter in print()
    The separator between the arguments to print() function in Python is space by default (softspace feature) , which can be modified and can be made to any character, integer or string as per our choice. The 'sep' parameter is used to achieve the same, it is found only in python 3.x or later. It is als
    3 min read
  • ascii() in Python
    Python ascii() function returns a string containing a printable representation of an object and escapes the non-ASCII characters in the string using \x, \u or \U escapes. It's a built-in function that takes one argument and returns a string that represents the object using only ASCII characters. Exa
    3 min read
  • Indentation in Python
    In Python, indentation is used to define blocks of code. It tells the Python interpreter that a group of statements belongs to a specific block. All statements with the same level of indentation are considered part of the same block. Indentation is achieved using whitespace (spaces or tabs) at the b
    2 min read
  • Access List Items in Python
    Accessing elements of a list is a common operation and can be done using different techniques. Below, we explore these methods in order of efficiency and their use cases. Indexing is the simplest and most direct way to access specific items in a list. Every item in a list has an index starting from
    2 min read
  • Python - Printing list vertically
    When working with lists in Python sometimes it's necessary to print the elements vertically. This can be useful when we want to display each item on a new line or present data in a structured format. In this article, we will explore various methods to print a list vertically starting with the simple
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences