Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Tiny helper for command-line python

Project Description

# command line tool #

Use like this:

cat data.tsv | cut -c4,9 | py “print(‘DELETE FROM sites WHERE id IN ({0})’.format(‘,’.join(IN)))” | psql testdb admin

Where the py bit replaces the slightly longer command:

python -c “import sys; print ‘DELETE FROM sites WHERE id IN ({0})’.format(‘,’.join(sys.stdin))”

I made this because I am tired of reading man pages for awk and sed and others; I already know python, but I am also tired of typing import sys, etc repeatedly.

os, sys, csv and json are pre-imported, as well as unicode_literals and print_function from the future.

Aditionally the following are imported and renamed:

sys.stdin -> IN sys.stdout -> OUT functools -> FT itertools -> IT operator -> OP pprint.pprint -> PP

For those interested in more robust solutions checkout <a href=’https://github.com/alecthomas/pawk’>pawk</a> or <a href=’http://code.google.com/p/pyp/’>pyp</a>.

Release History

This version
History Node

0.1

Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
shell-pype-0.1.1.tar.gz
(894 Bytes) Copy SHA256 Hash SHA256
Source None Feb 19, 2013

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting