Movatterモバイル変換


[0]ホーム

URL:


Previous PageUp One LevelNext PagePython Library ReferenceContentsModule IndexIndex
Previous:12.11.2 AddressList ObjectsUp:12. Internet Data HandlingNext:12.13 binascii

12.12base64 -- Encode and decode MIME base64 data

 

This module performs base64 encoding and decoding of arbitrary binarystrings into text strings that can be safely sent by email or includedas part of an HTTP POST request. Theencoding scheme is defined inRFC 1521 (MIME(Multipurpose Internet Mail Extensions) Part One: Mechanisms forSpecifying and Describing the Format of Internet Message Bodies,section 5.2, ``Base64 Content-Transfer-Encoding'') and is used forMIME email and various other Internet-related applications; it is notthe same as the output produced by theuuencode program.For example, the string'www.python.org' is encoded as thestring'd3d3LnB5dGhvbi5vcmc=\n'.

decode(input, output)
Decode the contents of theinput file and write the resultingbinary data to theoutput file.input andoutput must either be file objects or objects thatmimic the file object interface.input will be read untilinput.read() returns an empty string.

decodestring(s)
Decode the strings, which must contain one or more lines ofbase64 encoded data, and return a string containing the resultingbinary data.

encode(input, output)
Encode the contents of theinput file and write the resultingbase64 encoded data to theoutput file.input andoutput must either be file objects or objects thatmimic the file object interface.input will be read untilinput.read() returns an empty string.encode()returns the encoded data plus a trailing newline character('\n').

encodestring(s)
Encode the strings, which can contain arbitrary binary data,and return a string containing one or more lines ofbase64-encoded data.encodestring() returns astring containing one or more lines of base64-encoded dataalways including an extra trailing newline ('\n').

See Also:

Modulebinascii:
Support module containing ASCII-to-binary and binary-to-ASCII conversions.
RFC 1521,MIME (Multipurpose Internet Mail Extensions) Part One: Mechanisms for Specifying and Describing the Format of Internet Message Bodies
Section 5.2, ``Base64 Content-Transfer-Encoding,'' provides the definition of the base64 encoding.


Previous PageUp One LevelNext PagePython Library ReferenceContentsModule IndexIndex
Previous:12.11.2 AddressList ObjectsUp:12. Internet Data HandlingNext:12.13 binascii
Release 2.2.3, documentation updated on 30 May 2003.
SeeAbout this document... for information on suggesting changes.
[8]ページ先頭

©2009-2026 Movatter.jp