Python on the command line


More or less the only thing I do on the command line with python is to check the version number:


python -V
python --version

You can run some Python code without creating a file, but I don't remember ever needing this. If you insist


python -c "print 42"


python3 -c "print(42)"

Type the following to get the details:


man python

cmdline