Email and MIME Modules
email.mime.base
Base class for legacy MIME objects. MIMEBase initializes Content-Type and MIME-Version headers; callers supply media main type and subtype. It does not automatically encode an arbitrary payload, so specialized constructors are usually easier to use.
Formal Syntax & Structure
python syntaxpython
import email.mime.baseReturn Value
module
Module namespace available through import; import is a statement, not a value-returning expression.
Working Example
Example Snippetpython
from email.mime.base import MIMEBasepart = MIMEBase("application", "octet-stream")print(part["MIME-Version"], part.get_content_type())