fork download
  1. # coding=utf8
  2. # the above tag defines encoding for this document and is for Python 2.x compatibility
  3.  
  4. import re
  5.  
  6. pattern = r"(?=(?:.{4})*$)"
  7. s = "01234567891234oooooooooooooooo321"
  8. print(re.sub(pattern, "#", s))
  9.  
Success #stdin #stdout 0.03s 9524KB
stdin
Standard input is empty
stdout
0#1234#5678#9123#4ooo#oooo#oooo#oooo#o321#