py1
'python -c', with tab completion and shorthand
Usage
py [-x]
[-l]
[-c
PRE_CMD]
[-C
POST_CMD]
[-V]
[-h]
[expression]
Overview
pythonpy will evaluate any Python expression from the command line.
This will be done by the same Python interpreter that runs it. As this version uses Python 3, it is compatible with Python 3 syntax only.
Options
-
-x -
Treat each row of stdin as x
-
-l -
Treat list of stdin as l
-
-c PRE_CMD -
Run code before expression
-
-C POST_CMD -
Run code after expression
-
-V, --version -
Version info
-
-h, --help -
Show help message and exit
Examples
Float arithmetic:
$ py '3 * 1.5'
Import any module automatically:
$ py 'math.exp(1)'
Multiply each line of input by 7:
$ py 'range(3)' | py -x 'int(x)*7'
Remove every file returned by the find command:
$ find . -type f | py -x '"rm %s" % x' | sh
Releases
5 releases since Debian 9 (Stretch); the text changed 2 times.