a guest Mar 31st, 2020 122 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- def title_case(title, minor_words=''):
- all_caps = title.title().split()
- if len(all_caps) == 0:
- return ''
- for each in all_caps[1:]:
- if each.lower() + ' ' in minor_words.lower() or ' ' + each.lower() in minor_words.lower() or each.lower() in minor_words.lower():
- all_caps[all_caps.index(each)] = each.lower()
- str1 = ' '
- str1 = str1.join(all_caps)
- str1 = str1.replace(str1, str1.capitalize(), 1)
- return str1
- print(title_case('First a of in', 'an often into'))
RAW Paste Data