summaryrefslogtreecommitdiff
path: root/Lib/urllib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/urllib.py')
-rw-r--r--Lib/urllib.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py
index 1e633d8fd2..8234296908 100644
--- a/Lib/urllib.py
+++ b/Lib/urllib.py
@@ -169,9 +169,7 @@ class URLopener:
proxy = None
name = 'open_' + urltype
self.type = urltype
- if '-' in name:
- # replace - with _
- name = '_'.join(name.split('-'))
+ name = name.replace('-', '_')
if not hasattr(self, name):
if proxy:
return self.open_unknown_proxy(proxy, fullurl, data)
@@ -1045,9 +1043,7 @@ def unquote(s):
def unquote_plus(s):
"""unquote('%7e/abc+def') -> '~/abc def'"""
- if '+' in s:
- # replace '+' with ' '
- s = ' '.join(s.split('+'))
+ s = s.replace('+', ' ')
return unquote(s)
always_safe = ('ABCDEFGHIJKLMNOPQRSTUVWXYZ'