I'm trying to pipe python stdout output with xargs to curl and fail in this task.
curl is fine to accept input from echo
λ echo https://google.com | xargs curl
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="https://www.google.com/">here</A>.
</BODY></HTML>
but when printing the same from python, the xargs curl input becomes invalid on Windows (with cmder).
This works fine in WSL:
python3 -c"print('https://google.com')" | xargs curl
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="https://www.google.com/">here</A>.
</BODY></HTML>
But on Windows probably some newline/endlines interfere:
λ python -c"print('https://google.com')" | xargs curl
curl: (3) URL using bad/illegal format or missing URL
How do I clean python print output on Windows to make the above command work?