Skip to content

Instantly share code, notes, and snippets.

@cbronazc
Created May 28, 2019 20:50
Show Gist options
  • Save cbronazc/b80f45b8b3ba3c6ea80cd5818b177cb8 to your computer and use it in GitHub Desktop.
Save cbronazc/b80f45b8b3ba3c6ea80cd5818b177cb8 to your computer and use it in GitHub Desktop.
URL encode/decode
#!/usr/bin/python
import urllib
import sys
text = sys.argv[1]
encoded = urllib.quote_plus(text)
print encoded
#### decode #####
#!/usr/bin/python
from urllib import unquote
import sys
url = sys.argv[1]
decoded = unquote(url).decode('utf8')
print decoded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment