mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
parent
a0b1c77a19
commit
8debacb51c
5 changed files with 75 additions and 7 deletions
|
@ -29,13 +29,20 @@ There are several useful utilities provided in the :mod:`email.utils` module:
|
|||
fails, in which case a 2-tuple of ``('', '')`` is returned.
|
||||
|
||||
|
||||
.. function:: formataddr(pair)
|
||||
.. function:: formataddr(pair, charset='utf-8')
|
||||
|
||||
The inverse of :meth:`parseaddr`, this takes a 2-tuple of the form ``(realname,
|
||||
email_address)`` and returns the string value suitable for a :mailheader:`To` or
|
||||
:mailheader:`Cc` header. If the first element of *pair* is false, then the
|
||||
second element is returned unmodified.
|
||||
|
||||
Optional *charset* is the character set that will be used in the :rfc:`2047`
|
||||
encoding of the ``realname`` if the ``realname`` contains non-ASCII
|
||||
characters. Can be an instance of :class:`str` or a
|
||||
:class:`~email.charset.Charset`. Defaults to ``utf-8``.
|
||||
|
||||
.. versionchanged: 3.3 added the *charset* option
|
||||
|
||||
|
||||
.. function:: getaddresses(fieldvalues)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue