Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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.  '
Comment

python remove brackets from string

>>> import re
>>> my_str = 'Hello [World]'
>>> re.sub(r'[[]]', r'', my_str)
'Hello World'
Comment

PREVIOUS NEXT
Code Example
Python :: qtile: latest development version 
Python :: inspect last 5 rows of dataframe 
Python :: get all view port type dynamo revit 
Python :: sns linear regression 
Python :: how to copy items in list n times in list python 
Python :: frogenset ito dataframe pandas 
Python :: fibonacci sequence generator python 
Python :: create a fibonacci function using a generator python 
Python :: install matplotlib on nvidia jetson nx 
Python :: indentation error in python atom editor 
Python :: python iterate through list by chunks 
Python :: RuntimeError: cuda runtime error (711) : peer mapping resources exhausted at /pytorch/aten/src/THC/THCGeneral.cpp:139 
Python :: how to make a square multicolor square spiral python 
Python :: qtoverlay 
Python :: convert a column to camel case in python 
Python :: vs python 
Python :: how to print multiple lines in one line python 
Python :: EXCEL , EXTRAER DELIMITADOR 
Python :: get_multiple_items_from_list 
Python :: diccionario 
Python :: str.format() 
Python :: loader.py line 19 in get_template 
Python :: pairplot yaxis diagonal 
Python :: pyttsx3 interrupting an utterance 
Python :: Examples pandas.read_hfd5() 
Python :: Code to find maximum number using if else 
Python :: scikit learn lazy predict 
Python :: selenium emojis 
Python :: transfer learning in python with custom dataset 
Python :: Python NumPy atleast_2d Function Example 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =