Python: acronym
This commit is contained in:
parent
c3f4773fd7
commit
afc981a9ce
4 changed files with 106 additions and 0 deletions
7
python/acronym/acronym.py
Normal file
7
python/acronym/acronym.py
Normal 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))
|
||||
Loading…
Add table
Add a link
Reference in a new issue