Skip to content

Instantly share code, notes, and snippets.

@Jhonyrod
Created June 8, 2017 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jhonyrod/e4ef44b586e367695c8c8da7f6bc3377 to your computer and use it in GitHub Desktop.
Save Jhonyrod/e4ef44b586e367695c8c8da7f6bc3377 to your computer and use it in GitHub Desktop.
def cap(str):
return str[0].upper() + str[1:]
def title_case(title, minor_words = ''):
return cap(' '.join(list(map(lambda x: x.lower() if x.casefold() in minor_words.casefold().split() else x.capitalize(), title.split())))) if title else title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment