Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print python list without quotation marks or space after commas [duplicate]

Tags:

python

list

So right now I have a list of file names. I want to print them without the space after the comma and without quotation marks.

So basically I have a file that has the following output:

['1', '2', '3']

And I want the output to be

1,2,3
like image 603
Evilcalamari Avatar asked Jul 24 '26 14:07

Evilcalamari


1 Answers

Use the join method.

>>> your_list = ['1', '2', '3']
>>> print(', '.join(your_list))
1, 2, 3
like image 179
cs95 Avatar answered Jul 27 '26 05:07

cs95



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!