skip to navigation
skip to content

Not Logged In

oneliner 0.2.1

practical python one-liners

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
 
File Type Py Version Uploaded on Size
oneliner-0.2.1-py2.py3-none-any.whl (md5) Python Wheel 3.4 2015-05-05 7KB
oneliner-0.2.1.tar.gz (md5) Source 2015-05-05 5KB
  • Downloads (All Versions):
  • 41 downloads in the last day
  • 197 downloads in the last week
  • 499 downloads in the last month