Created
October 18, 2018 00:43
-
-
Save CptSpaceToaster/9fee5943a21f651333113758151c7d40 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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