Related Articles
Python | Ways to print list without quotes
• Last Updated : 25 Jun, 2019

Whenever we print list in Python, we generally use str(list) because of which we have single quotes in the output list. Suppose if the problem requires to print solution without quotes. Let’s see some ways to print list without quotes.

Method #1: Using `map()`

 `# Python code to demonstrate ``# printing list in a proper way`` ` `# Initialising list``ini_list ``=` `[``'a'``, ``'b'``, ``'c'``, ``'d'``]`` ` `# Printing initial list with str``print` `(``"List with str"``, ``str``(ini_list))`` ` `# Printing list using map``print` `(``"List in proper method"``, ``'[%s]'` `%` `', '``.join(``map``(``str``, ini_list)))`
Output:
```List with str ['a', 'b', 'c', 'd']
List in proper method [a, b, c, d]
```

Method #2: Using `sep` Method

 `# Python code to demonstrate ``# printing list in proper way`` ` `# Initialising list``ini_list ``=` `[``'a'``, ``'b'``, ``'c'``, ``'d'``]`` ` `# Printing initial list with str``print` `(``"List with str"``, ``str``(ini_list))`` ` `# Printing list using sep Method``print` `(``*``ini_list, sep ``=``', '``)`
Output:

```List with str ['a', 'b', 'c', 'd']
a, b, c, d
```

Method #3: Using .format()

 `# Python code to demonstrate ``# printing list in proper way`` ` `# Initialising list``ini_list ``=` `[``'a'``, ``'b'``, ``'c'``, ``'d'``]`` ` `# Printing initial list with str``print` `(``"List with str"``, ``str``(ini_list))`` ` `# Printing list using .format()``print` `(``"Printing list without quotes"``, (``"[{0}]"``.``format``(``                       ``', '``.join(``map``(``str``, ini_list)))))`
Output:
```List with str ['a', 'b', 'c', 'd']
Printing list without quotes [a, b, c, d]
```

Method #4: Using `translate` Method

 `# Python code to demonstrate ``# printing list in proper way`` ` `# Initialising list``ini_list ``=` `[``'a'``, ``'b'``, ``'c'``, ``'d'``]`` ` `# Printing initial list with str``print` `(``"List with str"``, ``str``(ini_list))`` ` `translation ``=` `{``39``: ``None``}``# Printing list using translate Method``print` `(``"Printing list without quotes"``, ``        ``str``(ini_list).translate(translation))`
Output:
```List with str ['a', 'b', 'c', 'd']
Printing list without quotes [a, b, c, d]
```

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up