How do i use replace function to replace "[ ]" These brackets | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do i use replace function to replace "[ ]" These brackets

I want to replace bracket and comas from list how can I do that

26th Dec 2019, 1:57 PM
Vishal Pandey
Vishal Pandey - avatar
6 Answers
+ 4
You mean, when you want to print it out? (If not, please ask.) print(*your_list) will do the trick.
26th Dec 2019, 2:03 PM
HonFu
HonFu - avatar
+ 3
Try it like I wrote, with a star. ['a', 'b', 'c'] will become a b c
26th Dec 2019, 2:27 PM
HonFu
HonFu - avatar
+ 2
Thank you so much it works
26th Dec 2019, 2:33 PM
Vishal Pandey
Vishal Pandey - avatar
+ 2
Try it like HonFu wrote: your_list = [4, 'a', 8, 'z'] print(*your_list) #output will be: 4 a 8 z
26th Dec 2019, 2:34 PM
Coding Cat
Coding Cat - avatar
0
[1,4,3,5,6,8,'k',8,'j',9,0,2,4,'k',9,'y',7,3] I want replace all comas, brackets and Parenthesis while printing it
26th Dec 2019, 2:09 PM
Vishal Pandey
Vishal Pandey - avatar
0
Thank you but I have done
26th Dec 2019, 2:35 PM
Vishal Pandey
Vishal Pandey - avatar