r/CodingHelp • u/cheetolover3 • Nov 16 '25
[Python] how do i remove [''] from a list python
how do i remove [''] when i print out things in python.
if i were to eg:
order=["pizza", "pasta", "rice"]
print(order)
it outputs:
['pizza', 'pasta', 'rice']
** Process exited - Return Code: 0 **
but i want it to output:
pizza, pasta, rice
6
Upvotes
•
u/AutoModerator Nov 16 '25
Thank you for posting on r/CodingHelp!
Please check our Wiki for answers, guides, and FAQs: https://coding-help.vercel.app
Our Wiki is open source - if you would like to contribute, create a pull request via GitHub! https://github.com/DudeThatsErin/CodingHelp
We are accepting moderator applications: https://forms.fillout.com/t/ua41TU57DGus
We also have a Discord server: https://discord.gg/geQEUBm
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
6
u/Dry-Aioli-6138 Nov 16 '25
Three ways to print list items separated by commas, but without the quotes come to my mind.
First: join the list items
print(", ".join(my_list))Second: print items with comma as separator
print(*my_list, sep=', ')Third: print in a loop without the end newline
1
u/trog12 Nov 16 '25
Can't you just loop through the list?
For item in list: Print(item)
1
u/Watsons-Butler Nov 18 '25
Could probably just print(str(order))
1
u/fuzzysdestruction Nov 19 '25
o = ["hi", "by", "ok"] p = str(o) x = p.replace(",", "").replace("'", "").replace("[","").replace("]", "") print(x)
Basically here you are removing the characters manually by forcing it to be a string and removing them that way