When a sequence of two-element tuples is used as the query argument, the first element of each tuple is a key and the second is a value. The value element in itself can be a sequence and in that case, if the optional parameter
doseq
evaluates to True, individual key=value pairs separated by ‘&’ are generated for each element of the value sequence for the key. The order of parameters in the encoded string will match the order of parameter tuples in the sequence.
Here is a simple example:
from urllib import parse
print(parse.urlencode({"a": [1, 2], "b": 1}, doseq=True))
# "a=1&a=2&b=1"
CLICK HERE to find out more related problems solutions.