0

I want to convert following statement from urllib to urllib2 equivalent statement

params = urllib.parse.urlencode( {'status': msg} )

I can import only urllib2 and urlparse.

1
  • urllib2 is not really the "2nd version" of urllib. It's not possible to "translate" all functionality from urllib to urllib2 Commented Jun 27, 2014 at 8:41

1 Answer 1

1

urllib2 is not really the "2nd version" of urllib. It's not possible to "translate" all functionality from urllib to urllib2.

Even the documentation for urllib2 states that you should use urllib for URL encoding.

Extracted from the urllib2.urlopen documentation:

...data should be a buffer in the standard application/x-www-form-urlencoded format. The urllib.urlencode() function takes a mapping or sequence of 2-tuples and returns a string in this format.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.