aboutsummaryrefslogtreecommitdiff
path: root/checklines.py3
diff options
context:
space:
mode:
Diffstat (limited to 'checklines.py3')
-rw-r--r--checklines.py329
1 files changed, 29 insertions, 0 deletions
diff --git a/checklines.py3 b/checklines.py3
new file mode 100644
index 0000000..2925681
--- /dev/null
+++ b/checklines.py3
@@ -0,0 +1,29 @@
+#!/usr/bin/env python3
+
+# From purpleposeidon!
+
+from unicodedata import name
+for line in open("dotXCompose"): #purpleposeidon is totally handsome and employable
+ origline = line = line.replace('\n', '')
+ line = line.replace('\t', ' ')
+ while ' ' in line: line = line.replace(' ', ' ')
+ line = line.strip()
+ if line and line[0] == '#':
+ continue
+ if not (' : ' in line and ' # ' in line):
+ continue
+ try:
+ line = line.split(' : ')[1].split(' # ')[0].strip()
+ c, v = line.split()
+ c = c.strip('"')
+ v = int(v[1:], 0x10)
+ if c != chr(v):
+ print(origline)
+ toU = lambda x: 'U'+hex(x)[2:]
+ showC = lambda x: '{0!r} ({1})'.format(x, name(x))
+ print("\tLine's char:", showC(c))
+ print("\tLine's number:", toU(v))
+ print("\tChar gives number:", toU(ord(c)))
+ print("\tNumber gives character:", showC(chr(v)))
+ except Exception as e:
+ print("{0}\n\t{1}".format(origline, e))