insert space in string python code example
Example 1: add whitespaces between char python
s = "BINGO"
print(" ".join(s))
Example 2: 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 ) !