Skip to content

Instantly share code, notes, and snippets.

@kharioki
Created October 10, 2016 19:40
Show Gist options
  • Save kharioki/e647a3a4024777ed371048f36a0f957e to your computer and use it in GitHub Desktop.
Save kharioki/e647a3a4024777ed371048f36a0f957e to your computer and use it in GitHub Desktop.
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