Search
 
SCRIPT & CODE EXAMPLE
 

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 )  ! 
Comment

add space before and after string python


import re

pat = re.compile(r"([.()!])")
print (pat.sub(" 1 ", string))
# hello .  .  .   ( world )  ! 

Comment

PREVIOUS NEXT
Code Example
:: télécharger librairie avec pip 
:: python custom class indexing 
::  
::  
::  
Python :: how to send image to template thats not in static flask 
::  
Python ::  
Python :: s=0 def sum(x,y): n=int(input("enter no. of terms") for i in range(n): l=int(input("enter no.")) s=s+l print(s) sum() 
Python ::  
:: discord.py add avatar to embed 
Python ::  
Python :: gui python 
::  
::  
::  
::  
Python :: k fold cross validation xgboost python 
Python ::  
Python ::  
::  
Python ::  
::  
Python ::  
Python ::  
::  
::  
::  
::  
::  
ADD CONTENT
Topic
Content
Source link
Name
6+7 =