tolkien-futhark-translator/futhark.py

50 lines
1.4 KiB
Python
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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)