'module' has no attribute 'urlencode' 'module' has no attribute 'urlencode' python python

'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().


import urllib.parseurllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})


You use the Python 2 docs but write your program in Python 3.