Say I want to print 1 + 1 on stdout (i.e. one-liner coding).
With awk I could do it simply with:
$ echo | awk '{print 1+1}'
2
How to do this with python?
you are looking for -c:
$ python -c 'print 1 + 1'
2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With