Merged revisions 81645 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81645 | senthil.kumaran | 2010-06-02 07:49:15 +0530 (Wed, 02 Jun 2010) | 3 lines

  Fix issue8788 - description of doseq parameter in urllib.urlencode
........
This commit is contained in:
Senthil Kumaran 2010-06-02 02:29:00 +00:00
parent ae16af2f40
commit c92c97cc04
1 changed files with 15 additions and 13 deletions

View File

@ -312,19 +312,21 @@ The :mod:`urllib.parse` module defines the following functions:
.. function:: urlencode(query, doseq=False) .. function:: urlencode(query, doseq=False)
Convert a mapping object or a sequence of two-element tuples to a "url-encoded" Convert a mapping object or a sequence of two-element tuples to a
string, suitable to pass to :func:`urlopen` above as the optional *data* "url-encoded" string, suitable to pass to :func:`urlopen` above as the
argument. This is useful to pass a dictionary of form fields to a ``POST`` optional *data* argument. This is useful to pass a dictionary of form
request. The resulting string is a series of ``key=value`` pairs separated by fields to a ``POST`` request. The resulting string is a series of
``'&'`` characters, where both *key* and *value* are quoted using ``key=value`` pairs separated by ``'&'`` characters, where both *key* and
:func:`quote_plus` above. If the optional parameter *doseq* is present and *value* are quoted using :func:`quote_plus` above. When a sequence of
evaluates to true, individual ``key=value`` pairs are generated for each element two-element tuples is used as the *query* argument, the first element of
of the sequence. When a sequence of two-element tuples is used as the *query* each tuple is a key and the second is a value. The value element in itself
argument, the first element of each tuple is a key and the second is a value. can be a sequence and in that case, if the optional parameter *doseq* is
The order of parameters in the encoded string will match the order of parameter evaluates to *True*, individual ``key=value`` pairs separated by ``'&'``are
tuples in the sequence. This module provides the functions generated for each element of the value sequence for the key. The order of
:func:`parse_qs` and :func:`parse_qsl` which are used to parse query strings parameters in the encoded string will match the order of parameter tuples in
into Python data structures. the sequence. This module provides the functions :func:`parse_qs` and
:func:`parse_qsl` which are used to parse query strings into Python data
structures.
.. seealso:: .. seealso::