Created
October 10, 2016 19:40
-
-
Save kharioki/e647a3a4024777ed371048f36a0f957e to your computer and use it in GitHub Desktop.
This file contains 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
def camel_snake(input): | |
output = [input[0].lower()] | |
for c in input[1:]: | |
if c in ('ABCDEFGHIJKLMNOPQRSTUVWXYZ'): | |
output.append('_') | |
output.append(c.lower()) | |
else: | |
output.append(c) | |
return str.join('', output) | |
snake_version = camel_snake("ThisIsTonyStark") | |
print(snake_version) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment