Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env python3
import argparse
import sys
def digest(infile):
for line in infile.readlines():
makeRegionalChars(line)
def makeRegionalChars(line):
for c in line.lower():
if c.isalpha():
print(bytes([240, 159, 135, 69+ord(c), 226, 128, 139]).decode(), end='')
elif c == ' ':
print(' ', end='')
else:
print(c, end='')
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Convert a string into regional emoji chars')
parser.add_argument('text', nargs='?', help='Text to mock')
parser.add_argument('-i', '--infile', type=argparse.FileType('r'), default=sys.stdin)
args = parser.parse_args()
if args.text:
makeRegionalChars(args.text + '\n')
else:
digest(args.infile)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment