Skip to main content
Help us improve Python packaging – donate today!

practical python one-liners

Project Description

This module tries to improve Python’s usefulness as a tool for writing shell one-liners.

# show line numbers
python -m oneliner -ne '"%5d: %s" % (NR, _)' < input.txt

# convert unix timestamp to something more human readable
date +%s | pyl -j ' => ' -line '_, datetime.datetime.fromtimestamp(int(_))'
# 1355256353 => 2012-12-11 22:05:53

# triple space a file
pyl -ne 'line + "\n"*2' < input.txt

# double space only non-blank lines:
pyl -ne '_ if re.match("^$", _) else _+"\n"' input.txt
Documentation:
http://python-oneliner.readthedocs.org/en/latest/
Development:
https://github.com/gvalkov/python-oneliner
Package:
http://pypi.python.org/pypi/oneliner

Release history Release notifications

This version
History Node

0.2.1

History Node

0.2.0

History Node

0.1.0

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
oneliner-0.2.1-py2.py3-none-any.whl (7.2 kB) Copy SHA256 hash SHA256 Wheel 3.4 May 5, 2015
oneliner-0.2.1.tar.gz (5.4 kB) Copy SHA256 hash SHA256 Source None May 5, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page