On Sat, Jan 30, 2016 at 3:46 PM, Hongyi Zhao <hongyi.z...@gmail.com> wrote: > I can use the following methods for mimicking tac command bellow: > > awk '{a[NR]=$0} END {while (NR) print a[NR--]}' input_file > perl -e 'print reverse<>' input_file > > Is it possible to do the same thing with python?
python -c 'import sys; print("".join(list(open(sys.argv[1]))[::-1]))' input_file Python doesn't have a short-hand for grabbing the file named as an argument, but it's easy enough to reverse stuff. ChrisA -- https://mail.python.org/mailman/listinfo/python-list