Answers for "how to remove brackets from text and contents in pyhton"

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
0

how to remove brackets from list in python text file

res = str(test_list)[1:-1]
Posted by: Guest on April-29-2021

Code answers related to "how to remove brackets from text and contents in pyhton"

Python Answers by Framework

Browse Popular Code Answers by Language