Remove Brackets And Commas From List In Python
Last updated June 21, 2023 by Jarvis Silva
in this tutorial I will show you how to remove brackets and commas from list in python, when we print a list in python it prints it with bracket and commas below is a example.
numbers = ["one","two","three"]
# Output we want without brackets and commas
one two three
First output is the normal output which python prints and second output is the one which I will show you how to get in this tutorial so follow till the end.
Python Code To Remove Brackets And Commas From List
fruits_list = ["Apple","Banana","Papaya","Grapes"]
new_fruits_list = ' '.join(fruits_list)
Above is the program for removing brackets and commas from list, in the code we convert the list to a single string which is done using the join() method/
Now to run this program you need to have python installed on your computer, If you don’t have then follow this guide: Install and setup python on your computer or use this online python compiler.
After running this program you will see that it printed the list without brackets and commas below is an example output of the above program.
Apple Banana Papaya Grapes
As you can see we successfully created this program in python, I hope you found this tutorial helpful and useful, do share this tutorial with your friends who might need this program.
Here are some more python program tutorials for you:
- Check If Backslash In String In Python.
- Python Program To Check If A Variable Is A Function.
- Python Program To Check If A Variable Is A Dictionary.
- Python Program To Check Even Or Odd Numbers.
- Python Program To Check Composite Numbers.
- Python Program To Check Whether A Person Is Senior Citizen Or Not.
- Python Program To Check Whether A Person Is Eligible To Vote Or Not.
I hope you found what you were looking for from this tutorial, and if you want more python programs and tutorials like this, do join our Telegram channel for future updates.
Thanks for reading, have a nice day 🙂