'module' has no attribute 'urlencode'
urllib
has been split up in Python 3
.
The urllib.urlencode()
function is now urllib.parse.urlencode()
,
the urllib.urlopen()
function is now urllib.request.urlopen()
.
You use the Python 2 docs but write your program in Python 3.
import urllib.parse
urllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})