toys

Tools and things that make my life easier - y'all might like them too

View the Project on GitHub pfuntner/toys

peval

Purpose

Evalulate a Python expression

Syntax

Syntax: peval [-i|--import MODULE] expression ...

Options and arguments

| Option | Description | Default | | —— | ———– | ——- | | -i or --import | Import a module | Since the bulk of the code is just a print statement of the arguments on the command line, this option can be used to import a Python module such as os, path, re, etc. |

Example

$ peval --import datetime 'datetime.datetime.now().isoformat()', 'range(25)'
('2018-09-25T17:07:10.967965', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24])
$

Notes