Horje
add space before and after string python Code Example
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 )  ! 




Python

Related
for loop with index python Code Example for loop with index python Code Example
add two dataframes together Code Example add two dataframes together Code Example
join tables pandas Code Example join tables pandas Code Example
how to write a function in python Code Example how to write a function in python Code Example
Concatenating objects in pandas Code Example Concatenating objects in pandas Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8