On Thu, Nov 13, 2008 at 11:14 AM, Steve Bricker
<[EMAIL PROTECTED]> wrote:
> I am trying to build an application for work that FTPs a file from an IBM
> mainframe to my Windows desktop then process it.  The EBCDIC-to-ASCII
> conversion works nicely (using a BAT file I created) except for three
> packed-decimal data fields (for example, X'0000000000000000014C' is equal to
> integer 14).  I am assuming I need to go through this byte-by-byte to
> convert.  Is that the best approach, or is there a better way?

Python includes an EBCDIC codec. If s is a byte string containing
EBCDIC characters, then
s.decode('EBCDIC-CP-BE').encode('ascii')
should give you the ASCII equivalent.

Kent
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to