File: grid.py

package info (click to toggle)
fonts-ubuntu 0.83-4
  • links: PTS, VCS
  • area: non-free
  • in suites: bullseye, buster
  • size: 26,064 kB
  • sloc: python: 91; makefile: 30; sh: 9
file content (20 lines) | stat: -rwxr-xr-x 591 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python
# Paul Sladen 2011-09-27, Copyright 2011 Canonical Ltd.  Distributed under the terms of the GNU GPL v3

import sys

def main(codepoint_source = 'cp437.set'):
    try:
        codepoint_source = sys.argv[1]
    except IndexError: pass
    sampler = ''
    for codepoint,i in zip(open(codepoint_source, 'r').readlines(),xrange(1000)):
        try:
            sampler += (unichr(int(codepoint.split('+')[1],16)))
            if (i+1) % 16 == 0:
                sampler += '\n'
        except: break
    print sampler.encode('UTF-8'),

if __name__=='__main__':
    main()