py(1)
πΈ py(1) β your new bestie for command-line Python πΈ
okay so real talk, this is the manual for py(1), and honestly? it's a whole vibe. stick around, bestie, we're gonna get you fluent. π
β¨ NAME β¨
pythonpy β literally just python -c, but with tab completion and shorthand, and honestly it ate. π₯
β¨ SYNOPSIS β¨
py [-x] [-l] [-c PRE_CMD] [-C POST_CMD] [-V] [-h] [expression]
β¨ DESCRIPTION β¨
pythonpy will evaluate any Python expression straight from the command line. no cap, any of them. β¨
and get this β the evaluating is done by the exact same Python interpreter that runs pythonpy itself. main character energy, honestly. and because this version uses Python 3, it is compatible with Python 3 syntax only. so if you roll up with Python 2 syntax, it's giving π β no cap. π«Ά
β¨ OPTIONS β¨
-xβ treat each row of stdin asx. every single line, one at a time. π-lβ treat the list of stdin asl. the whole buffet, as a list. π-c PRE_CMDβ run code before the expression. pregame, but make it code. β¨-C POST_CMDβ run code after the expression. the outro, the aftershow. π-V,--versionβ version info. the receipts, basically. π-h,--helpβ show the help message and exit. it's the "bestie explain" button. πΈ
β¨ EXAMPLES β¨
float arithmetic, because decimals deserve love too:
$ py '3 * 1.5'
import any module automatically, no import statement needed, iconic behaviour honestly:
$ py 'math.exp(1)'
multiply each line of input by 7 β see how the -x makes x be each row:
$ py 'range(3)' | py -x 'int(x)*7'
and the unhinged-but-useful one β remove every file returned by the find command (yes, it pipes into sh, and yes, that's a lot of power, so maybe vibe check your find before you commit π):
$ find . -type f | py -x '"rm %s" % x' | sh
β¨ SEE ALSO β¨
python(1) β the parent, the origin story. π¦
β¨ BUGS β¨
found a bug? bestie, don't sit on it π β bugs should be reported as issues at the project's GitHub page: <https://github.com/Russell91/pythonpy/issues>
β¨ AUTHOR β¨
pythonpy is developed by Russell Stewart <russell.s.stewart@gmail.com>. π
this man page was written by Tiago Ilieve <tiago.myhro@gmail.com> for the Debian distribution (but it may be used by others). π
that's the whole thing, bestie β dated 02 December 2024, and it's the py(1) page from this very same py(1) manual. iykyk π
β¨
π¦ where this page comes from
- debian trixie: pythonpy 0.4.11b-4 Β· MIT
- ubuntu resolute: pythonpy 0.4.11b-4 Β· MIT
- ubuntu stonking: pythonpy 0.4.11b-4 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms