Movatterモバイル変換
[0]ホーム
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 until
input.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 until
input.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').
SeeAbout this document... for information on suggesting changes.
[8]ページ先頭