Email and MIME Modules

email.charset

Legacy charset metadata for mapping character encodings and transfer encodings in email. Charset objects describe encoding choices for headers and bodies. Prefer EmailMessage and explicit policies for new message composition.

Formal Syntax & Structure

python syntaxpython
import email.charset

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
from email.charset import Charsetcharset = Charset("utf-8")print(charset.get_output_charset())
Python Reference