Python: acronym

This commit is contained in:
Dmitry Kokorin 2021-06-08 17:06:38 +03:00
parent c3f4773fd7
commit afc981a9ce
4 changed files with 106 additions and 0 deletions

View file

@ -0,0 +1,7 @@
import re
WORD_REGEX = re.compile(r"([^\W_]+(?:'[^\W_]+)?)")
def abbreviate(words):
return ''.join(s[0].upper() for s in re.findall(WORD_REGEX, words))