Teks sumber — English
Terjemahan — Bahasa Indonesia
mimetypes
mimetypes
Add a public :ref:`command-line <mimetypes-cli>` for the module, invoked via :program:`python -m mimetypes`. (Contributed by Oleg Iarygin and Hugo van Kemenade in :gh:`93096`.)
The import time for several standard library modules has been improved, including :mod:`annotationlib`, :mod:`ast`, :mod:`asyncio`, :mod:`base64`, :mod:`cmd`, :mod:`csv`, :mod:`gettext`, :mod:`importlib.util`, :mod:`locale`, :mod:`mimetypes`, :mod:`optparse`, :mod:`pickle`, :mod:`pprint`, :mod:`pstats`, :mod:`shlex`, :mod:`socket`, :mod:`string`, :mod:`subprocess`, :mod:`threading`, :mod:`tomllib`, :mod:`types`, and :mod:`zipfile`.
:mod:`mimetypes`: Valid extensions are either empty or must start with '.' for :meth:`mimetypes.MimeTypes.add_type`. Undotted extensions are deprecated and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van Kemenade in :gh:`75223`.)
:mod:`mimetypes`:
:mod:`mimetypes`:
Valid extensions start with a '.' or are empty for :meth:`mimetypes.MimeTypes.add_type`. Undotted extensions are deprecated and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van Kemenade in :gh:`75223`.)
As part of making the :mod:`mimetypes` CLI public, it now exits with ``1`` on failure instead of ``0`` and ``2`` on incorrect command-line parameters instead of ``1``. Error messages are now printed to stderr.