fork download
  1. import re
  2. test_str = "ThisIsCamelCased"
  3. p = re.compile(r'(\S)([A-Z])')
  4. result = re.sub(p, r"\1_\2", test_str)
  5. print(result.lower())
Success #stdin #stdout 0.01s 7296KB
stdin
Standard input is empty
stdout
this_is_camel_cased