4 ms·
Suppose your input to any of these contains quotation marks, or perhaps a mix of quotation marks. Then you have to use more and more exotic forms of quoting and
by rgovostes 6y ago
Suppose your input to any of these contains quotation marks, or perhaps a mix of quotation marks. Then you have to use more and more exotic forms of quoting and escaping.
In Python 2.7, encoding to Base64 in a pipe used to be a mouthful:
echo "foo" | python2.7 -c 'import sys; print sys.stdin.read().encode("base64")'
Now it's even worse:
echo "foo" | python3 -c 'import base64,sys; print(base64.b64encode(sys.stdin.buffer.read()).decode("ascii"))'
As an aside, the base64 module is a good example of how rough the Python standard library is, and it seems like no one is being a gatekeeper of new changes. Almost no one wants base64.decode, but base64.b64decode. Or maybe base64.standard_b64encode? Or base64.encodebytes? Not to mention the majority of functions in the module are _not_ related to Base64 but other encodings.
- wraptile 6y agoYou're really nitpicking here. There's nothing an alias or a 3 line `~/bin` script can't solve. As for base64, there's already a several decade old gnu util available in every terminal.