LearnPy Hub
← Regular Expressions problems
Medium

camelCase to snake_case

Convert a camelCase name to snake_case with re.sub: put an underscore before each upper-case letter (not at the start) and lower everything.

Input

One identifier.

Output

snake_case.

Sample 1

Input
myVariableName
Output
my_variable_name

Sample 2

Input
x
Output
x
solution.py
Output appears here
camelCase to snake_case · Python practice problem · LearnPy Hub