true = True false = False s = ''' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-_~./<>[]:&↓#="\*?%+,()@'!$;`^{}▲▼◀▶←½🗖🗕□。「」、・ヲァィゥェォャュョッーアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン゛゜''' it = iter(s) d = {} f = open('zfont.txt', 'r') for line in f: if line.startswith(';'): c = str(ord(next(it))) d[c] = [0, 0, 0, 0, 0, 0, 0] elif not line.startswith('EOF'): d[c].append(4 * int(line.strip()[::-1], 2)) for k in d: d[k].extend([0, 0, 0, 0]) d.update({"name":"ZFONT","copy":"","letterspace":"64","basefont_size":"200","basefont_left":"62","basefont_top":"0","basefont":"Courier","basefont2":"","monospace":true,"monospacewidth":"6","ascender":"5","descender":"0"}) import json print(json.dumps(d))