Converting Characters from one textfile into Unicode Numbers saving them in another file
# -*- coding: utf-8 -*-
import unicodedata
gl = open('GlyphList.txt')
string = str(gl.read())
string = unicode(string, 'utf-8')
gl.close()
glyphs = string.split()
try:
# This tries to open an existing file but creates a new file if necessary.
gl_unicode = open('GlyphsList-UniCode.txt', 'w')
except IOError:
pass
for glyph in glyphs:
# glyph = unicodedata.name(glyph)
glyph = '%04x' % ord(glyph)
gl_unicode.write(str(glyph) +'\n')
gl_unicode.close()