From db37cb36c70641c4cb4d5463468dcee6b9f15dd7 Mon Sep 17 00:00:00 2001 From: Mark Shoulson Date: Wed, 28 Dec 2011 18:38:15 -0500 Subject: added checklines.py3 (as given by purpleposeidon) and fixed corrections it found. --- checklines.py3 | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 checklines.py3 (limited to 'checklines.py3') 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)) -- cgit v1.2.3