Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

add space before and after string python

using re adds white-space before and after the desired characters:

import re

pat = re.compile(r"([.()!])")
print (pat.sub(" 1 ", string))
# hello .  .  .   ( world )  ! 
 
PREVIOUS NEXT
Tagged: #add #space #string #python
ADD COMMENT
Topic
Name
4+9 =