File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -101,14 +101,25 @@ be accessed under their Python 3 names and locations in Python 2::
101101 import xmlrpc.client
102102 import xmlrpc.server
103103
104- ``urllib `` currently requires explicit imports because the name clashes with that on Python 2::
104+ ``urllib `` currently requires an explicit import because the name clashes with
105+ that on Python 2 and because Python's syntax does not allow imports of this
106+ form with a dotted module name after ``as ``::
107+
108+ import future.moves.urllib.parse as urllib.parse
109+
110+ For submodules of ``urllib `` and other packages (like ``http ``), this
111+ alternative form is available::
105112
106113 from future.standard_library import import_
114+
107115 urllib = import_('urllib')
108116 import_('urllib.parse')
109117 import_('urllib.request')
110118 import_('urllib.error')
111119
120+ response = urllib.request.urlopen('http://mywebsite.com')
121+ # etc.
122+
112123For an explanation of these and other forms of imports from the standard
113124library, see :ref: `standard-library-imports `.
114125
You can’t perform that action at this time.
0 commit comments