Skip to content

Instantly share code, notes, and snippets.

@richo
Created May 16, 2018 17:51
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 richo/5ec13eef98cb2bb798fb757415a6a823 to your computer and use it in GitHub Desktop.
Save richo/5ec13eef98cb2bb798fb757415a6a823 to your computer and use it in GitHub Desktop.
import sys
import string
replacements = {
'!': ':exclamation:',
'?': ':question:',
'0': ':zero:',
'1': ':one:',
'2': ':two:',
'3': ':three:',
'4': ':four:',
'5': ':five:',
'6': ':six:',
'7': ':seven:',
'8': ':eight:',
'9': ':nine:',
}
def embiggen_word(word):
def inner(_word):
for i in word.lower():
if i in string.ascii_lowercase:
yield ":big-%s:" % i
else:
yield replacements.get(i, i)
return ''.join(inner(word))
sys.stdout.write(":sparkles:%s:end_sparkles:" % (' '.join(map(embiggen_word, sys.argv[1:]))))
sys.stdout.flush()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment