Answers for "remove brackets from string python"

0

how to remove text in brackets of python

>>> import re 
>>> x = "This is a sentence. (once a day) [twice a day]"
>>> re.sub("[\(\[].*?[\)\]]", "", x)
'This is a sentence.  '
Posted by: Guest on May-31-2020
1

how do i remove the brackets around a list in python

l = ['a', 2, 'c']
print str(l)[1:-1]
'a', 2, 'c'
Posted by: Guest on March-14-2020
0

remove brackets from string python

premrtrtryt
Posted by: Guest on August-12-2021

Code answers related to "remove brackets from string python"

Python Answers by Framework

Browse Popular Code Answers by Language