fork download
  1. import re
  2.  
  3. s = "test001"
  4. print(re.sub(r'^(\D+)(\d+)$', lambda x: rf'{x.group(1)}-{x.group(2).zfill(5)}', s))
  5.  
Success #stdin #stdout 0.03s 9388KB
stdin
Standard input is empty
stdout
test-00001