|Usage: python3 regional.py list of words|
|Prints a representation of the words as Regional Identifiers, and copies the output directly to keyboard for you|
|This is because some terminals think that zero width spaces are silly.|
|Currently supports: A-Z|
|Requires: Python 3|
|Now less complex, thanks @bmispelon!|
|# Try and see if there's a REGIONAL INDICATOR SYMBOL for our letter.|
|return unicodedata.lookup('REGIONAL INDICATOR SYMBOL LETTER %s' % letter.upper());|
|output = "\u200B".join([regional_indicator(x) for x in " ".join(sys.argv[1:]).upper()])|
|print("Copied to Clipboard: %s" % output)|
A few more silly comments:
The list comprehension's brackets '[ ]' inside the join() can be removed to turn it into a generator expression, which is faster and does the same thing.
The code currently sandwiches Zero-Width Spaces between regional indicators and spaces between words, which isn't necessary. Can be fixed by joining with U+200B before joining with " ".