Python public recipes
The code replaces all of the metacharacters found in the string with the underscore character.
import re
re.sub(r'(?<!^)(?=[A-Z])', '_', your_string).lower()
The code replaces all of the metacharacters found in the string with the underscore character.
import re
re.sub(r'(?<!^)(?=[A-Z])', '_', your_string).lower()