Movatterモバイル変換


[0]ホーム

URL:


Navigation

19.7.binhex — Encode and decode binhex4 files

This module encodes and decodes files in binhex4 format, a format allowingrepresentation of Macintosh files in ASCII. Only the data fork is handled.

Thebinhex module defines the following functions:

binhex.binhex(input,output)

Convert a binary file with filenameinput to binhex fileoutput. Theoutput parameter can either be a filename or a file-like object (any objectsupporting awrite() andclose() method).

binhex.hexbin(input,output)

Decode a binhex fileinput.input may be a filename or a file-like objectsupportingread() andclose() methods. The resulting file is writtento a file namedoutput, unless the argument isNone in which case theoutput filename is read from the binhex file.

The following exception is also defined:

exceptionbinhex.Error

Exception raised when something can’t be encoded using the binhex format (forexample, a filename is too long to fit in the filename field), or when input isnot properly encoded binhex data.

See also

Modulebinascii
Support module containing ASCII-to-binary and binary-to-ASCII conversions.

19.7.1. Notes

There is an alternative, more powerful interface to the coder and decoder, seethe source for details.

If you code or decode textfiles on non-Macintosh platforms they will still usethe old Macintosh newline convention (carriage-return as end of line).

As of this writing,hexbin() appears to not work in all cases.

Table Of Contents

Previous topic

19.6.base64 — RFC 3548: Base16, Base32, Base64 Data Encodings

Next topic

19.8.binascii — Convert between binary and ASCII

This Page

Quick search

Enter search terms or a module, class or function name.

Navigation

©Copyright 1990-2017, Python Software Foundation.
The Python Software Foundation is a non-profit corporation.Please donate.
Last updated on Sep 19, 2017.Found a bug?
Created usingSphinx 1.2.

[8]ページ先頭

©2009-2025 Movatter.jp