Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Capitalize string
def capitalize(string, lower_rest=True):
return string[:1].upper() + (string[1:].lower() if lower_rest else string[1:])
capitalize('fooBar') # 'Foobar'
capitalize('fooBar', False) # 'FooBar'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.