Last active
January 3, 2016 18:09
-
-
Save jbreams/8500114 to your computer and use it in GitHub Desktop.
This script will take the first command-line arguments and add as many umlauts as possible to it.
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/python | |
# coding=utf8 | |
import sys | |
umlauts = { | |
'A': [ 'Ä', 'Ǟ' ], | |
'a': [ 'ä', 'ǟ' ], | |
'E': [ 'Ë' ], | |
'e': [ 'ë' ], | |
'h': [ 'ḧ' ], | |
'H': [ 'Ḧ' ], | |
'I': [ 'Ḯ', 'Ḯ' ], | |
'i': [ 'ï', 'ḯ' ], | |
'O': [ 'Ö', 'Ȫ', 'Ṏ' ], | |
'o': [ 'ö', 'ȫ', 'ṏ' ], | |
'U': [ 'Ü', 'Ǖ', 'Ǘ', 'Ǚ', 'Ǜ', 'Ṳ', 'Ṻ' ], | |
'u': [ 'ü', 'ǖ', 'ǘ', 'ǚ', 'ǜ', 'ṳ', 'ṻ' ], | |
'W': [ 'Ẅ' ], | |
'w': [ 'ẅ' ], | |
'X': [ 'Ẍ' ], | |
'x': [ 'ẍ' ], | |
'Y': [ 'Ÿ' ], | |
'y': [ 'ÿ' ] | |
} | |
o = [] | |
for c in sys.argv[1]: | |
if c in umlauts: | |
o.append(umlauts[c][0]) | |
if len(umlauts[c]) > 1: | |
umlauts[c].pop(0) | |
else: | |
o.append(c) | |
print ''.join(o) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment