ISO Latin-1 <-> Vax 7-bit ASCII SF2

Fredrik Lundh fredrik at pythonware.com
Mon May 10 09:14:33 EDT 1999


Kari Marttila <Kari.Marttila at tieto.com> wrote:
> My boss told me to write a program that converts ISO Latin-1 to Vax
> 7-bit ASCII SF2. I was just wondering if there already is a Python
> script that does this. If not, does anybody has an idea where to get the
> conversion table?

I've attached two datafiles and a short Python
script that you may find useful.  the mktable.py
script generates two lookup tables.  combining
these tables with string.translate and the file-
input module should do the trick:

    # untested
    table = string.join(map(chr, ascii2latin), "")
    for line in fileinput.fileinput(inplace=1, backup=".bak"):
        sys.stdout.write(string.translate(line, table))

</F>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: latin1.enc
Type: application/octet-stream
Size: 2533 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/19990510/c80f525a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mktable.py
Type: application/octet-stream
Size: 782 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/19990510/c80f525a/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: swascii.enc
Type: application/octet-stream
Size: 797 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/19990510/c80f525a/attachment-0002.obj>


More information about the Python-list mailing list