using re adds white-space before and after the desired characters:
import re
pat = re.compile(r"([.()!])")
print (pat.sub(" 1 ", string))
# hello . . . ( world ) !
import re
pat = re.compile(r"([.()!])")
print (pat.sub(" 1 ", string))
# hello . . . ( world ) !
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 :: |
:: |
:: |
:: |
:: |
:: |