Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Title_Case

a guest Mar 31st, 2020 122 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def title_case(title, minor_words=''):
  2.     all_caps = title.title().split()
  3.     if len(all_caps) == 0:
  4.         return ''
  5.     for each in all_caps[1:]:
  6.         if each.lower() + ' ' in minor_words.lower() or ' ' + each.lower() in minor_words.lower() or each.lower() in minor_words.lower():
  7.             all_caps[all_caps.index(each)] = each.lower()
  8.     str1 = ' '
  9.     str1 = str1.join(all_caps)
  10.     str1 = str1.replace(str1[0], str1[0].capitalize(), 1)
  11.  
  12.     return str1
  13.  
  14. print(title_case('First a of in', 'an often into'))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top