#!/usr/bin/python3 import sys import fileinput futhark_tolkien = [["ee", "ᛟ"], ["oo", "ᛳ"], ["ea", "ᛠ"], ["eo", "ᛇ"], ["ng", "ᛝ"], ["st", "ᛥ"], ["th", "ᚦ"], ["sh", "ᛲ"], ["a", "ᚫ"], ["b", "ᛒ"], ["c", "ᚳ"], ["d", "ᛞ"], ["e", "ᛖ"], ["f", "ᚠ"], ["g", "ᚷ"], ["h", "ᚻ"], ["i", "ᛁ"], ["j", "ᛁ"], ["k", "ᛱ"], ["l", "ᛚ"], ["m", "ᛗ"], ["n", "ᚾ"], ["o", "ᚩ"], ["p", "ᛈ"], ["q", "ᚳᚹ"], ["r", "ᚱ"], ["s", "ᛋ"], ["t", "ᛏ"], ["u", "ᚢ"], ["v", "ᚢ"], ["w", "ᚹ"], ["x", "ᛉ"], ["y", "ᚣ"], ["z", "ᛣ"], [".", "᛫"], [",", "᛭"], ["?",":"]] with open(sys.argv[1], 'r') as f1 : with open(sys.argv[2], 'w') as f2: for line in f1: replaced = line for rune in futhark_tolkien: replaced = replaced.replace(rune[0], rune[1]) f2.write(replaced)