pyp

Run Python code at the shell with magical automatic variable handling

brewmacoslinux
Try with needOr install directly
Source

About

Easily run Python at the shell! Magical, but never mysterious

Commands

pyp

Examples

Transform input lines to uppercase$ echo -e 'hello\nworld' | pyp 'x.upper()'
Filter lines longer than 5 characters$ echo -e 'hi\nhello\nworld' | pyp 'x if len(x) > 5'
Parse JSON and extract a field from each line$ echo '{"name":"Alice"}' | pyp 'json.loads(x)["name"]'