mirror of
https://github.com/python/cpython.git
synced 2025-07-19 17:25:54 +00:00
Revert 1.170. Add tests.
This commit is contained in:
parent
803ce801ab
commit
2bdec7bfb0
2 changed files with 12 additions and 3 deletions
|
@ -1110,9 +1110,12 @@ def quote(s, safe = '/'):
|
|||
def quote_plus(s, safe = ''):
|
||||
"""Quote the query fragment of a URL; replacing ' ' with '+'"""
|
||||
if ' ' in s:
|
||||
s = s.replace(' ', '+')
|
||||
safe += '+'
|
||||
return quote(s, safe)
|
||||
l = s.split(' ')
|
||||
for i in range(len(l)):
|
||||
l[i] = quote(l[i], safe)
|
||||
return '+'.join(l)
|
||||
else:
|
||||
return quote(s, safe)
|
||||
|
||||
def urlencode(query,doseq=0):
|
||||
"""Encode a sequence of two-element tuples or dictionary into a URL query string.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue