DEV Community

Discussion on: Python urldecode on command line

Collapse
 
rrampage profile image
Raunak Ramakrishnan • Edited

We can also do it without xargs by using sys.stdin to read from pipe
e.g:

yes 'Mozilla%2F5.0%20%28Macintosh%3B%20U%3B%20Intel%20Mac%20OS%20X%2010.6%3B%20en' |\
 head -n 10 |\
 python3 -c "import sys, urllib.parse as ul; [print(ul.unquote_plus(l), end='') for l in sys.stdin]"
Collapse
 
k4ml profile image
Kamal Mustafa

Thanks for the tips!