Answers for "python every 2 characters add a space"

1

add whitespaces between char python

s = "BINGO"
print(" ".join(s))
Posted by: Guest on February-23-2020
0

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 )  !
Posted by: Guest on March-20-2021

Code answers related to "python every 2 characters add a space"

Python Answers by Framework

Browse Popular Code Answers by Language