helm/bin/urlencode

13 lines
264 B
Plaintext
Raw Normal View History

2016-11-15 05:08:57 -08:00
#!/usr/bin/env python
2017-04-24 23:58:25 -07:00
import sys
try:
from urllib.parse import quote_plus
except ImportError:
from urllib import quote_plus
if sys.argv[1:]:
text = " ".join(sys.argv[1:])
2016-11-15 05:08:57 -08:00
else:
text = "".join(sys.stdin.readlines())
2017-04-24 23:58:25 -07:00
print(quote_plus(text.strip()))