Convert camelCase to snake_case
def camelCase2snake_case(txt):
"""
Convert camelCase to snake_case
https://regex101.com/library/wUcSv4
"""
txt = re.sub(r'([A-Z]+)', '_\\1', txt.strip())
txt = txt.lower()
return txt
In Python 🐍 the \L
case modifier in the substitution pattern to lower case is not supported.
By JV-conseil