Chapter 22. MIME and Network Encodings
What travels on a network are streams of bytes or text. However, what you want to send over the network often has more structure. The Multipurpose Internet Mail Extensions (MIME) and other encoding standards bridge the gap by specifying how to represent structured data as bytes or text. Python supports such encodings through many library modules, such as base64, quopri, and uu (covered in "Encoding Binary Data as Text" on page 561), and the modules of the email package (covered in "MIME and Email Format Handling" on page 564).