Skip to main content

Evaluate and display command line expressions with python -me expr

Project description

For example:

$ python -me 1 + 1

Like python -c but no need for a print. But wait, there’s more.

As a bonus, if the first argument is a module name then it will output the location of the module source code:

$ python -me os

If you follow the name of the module with a command then the module will be opened with that command. For example, the following will open the os module source in vim:

$ python -me os vim

The “e” module recognises the special command names “edit” and “view” which will result in it looking up your editor and viewer commands in the environment variables $EDITOR and $PAGER respectively. The latter defaults to “less”. This is slightly easier than writing, for example:

$ vim `python -me os`

… especially if you’re going back to edit a previous “python -me” command using line editing.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for e, version 1.4.2
Filename, size File type Python version Upload date Hashes
Filename, size e-1.4.2.tar.gz (1.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page