Created
April 21, 2023 06:12
-
-
Save filevich/8ce1ec36837976612820b73a7ab791c7 to your computer and use it in GitHub Desktop.
pascal to lower snake case in python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
s = lambda txt: re.sub(r'(?<!^)(?=[A-Z])', '_', txt).lower() | |
# eg: s("FooBarBaz") returns "foo_bar_baz" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment