helm/bin/urlencode

8 lines
193 B
Plaintext
Raw Normal View History

2016-11-15 05:08:57 -08:00
#!/usr/bin/env python
import os, sys, urllib
if os.isatty(file.fileno(sys.stdin)):
text = sys.argv[1]
else:
text = "".join(sys.stdin.readlines())
print(urllib.quote_plus(text.strip()))