[Tutor] trying to translate and ebcidic file

Mark Tolonen metolone+gmane at gmail.com
Wed Jun 15 11:20:27 CEST 2011


"Prinn, Craig" <Craig.Prinn at bowebellhowell.com> wrote in message 
news:6B49A56A6E493F4EBA255F6F197F070F050E4FE26A at BBH-MAIL1.bbh.priv...
> I am looking for a way to translate and ebcidic file to ascii. Is there a 
> pre-existing library for this, or do I need to do this from scratch? If
 > from scratch and ideas on where to start?

There are a couple of EBCDIC codecs (see list of codecs in 
http://docs.python.org/library/codecs.html).

Try:    open('file.txt').read().decode('ibm500').encode('ascii','replace')

You'll get '?' for chars ascii doesn't support.

-Mark





More information about the Tutor mailing list