Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

regular expression to remove space python

r = re.compile(r"^s+", re.MULTILINE)
r.sub("", "a
 b
 c") # "a
b
c"

# or without compiling (only possible for Python 2.7+ because the flags option
# didn't exist in earlier versions of re.sub)

re.sub(r"^s+", "", "a
 b
 c", flags = re.MULTILINE)

# but mind that s includes newlines:
r.sub("", "a



 b
 c") # "a
b
c"
Comment

PREVIOUS NEXT
Code Example
Python :: print specific list item python 
Python :: python remove repeated elements from list 
Python :: pip install python-telegram-bot 
Python :: how to file in python 
Python :: python time function in for loop 
Python :: pandas drop row from a list of vlaue 
Python :: delete database entry using name django 
Python :: python remove everything after character 
Python :: the boys 
Python :: python fillna with mean in a dataframe 
Python :: dictionary size in python 
Python :: print current line number python 
Python :: installation of uvicorn with only pure python dependencies 
Python :: ordereddict 
Python :: django migrate not creating tables 
Python :: str to tuple of float 
Python :: combination 
Python :: create a blank image 
Python :: how to play mp3 files using vlc python library 
Python :: django get form data from post 
Python :: find all color in image python 
Python :: types of system 
Python :: convert 1 to "one" python 
Python :: what does .shape do in python 
Python :: how to find a word in list python 
Python :: leap year python 
Python :: python challenges 
Python :: pandas df filter by time hour 
Python :: python convert a list to dict 
Python :: how to run .exe from python 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =