Python: Convert camel case string to snake case string
Python Regular Expression: Exercise-36 with Solution
Write a python program to convert camel case string to snake case string.
def camel_to_snake(text): import re str1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', text) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', str1).lower() print(camel_to_snake('PythonExercises'))
Visualize Python code execution:
The following tool visualize what the computer is doing step-by-step as it executes the said program:
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?