When I try to run a Python wiki example related to URL encoding:
>>> import urllib >>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0}) >>> f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query", params) >>> print f.read()
The second line gives an error:
Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'urlencode'
What am I missing?
Croll Mar 06 '15 at 20:13 2015-03-06 20:13
source share