
6 Jul
2016
6 Jul
'16
2:32 a.m.
tac - concatenate and print files in reverse On 6/07/2016 2:16 PM, Lawrence D'Oliveiro wrote:
On Wed, 6 Jul 2016 01:20:04 +0000, Ian Stewart wrote:
f = open(filename, "r")
...
f.close() No need to worry about closing a file that was opened read-only.
Also, true command-line tools read their args from the command line, not from additional user input. :)
The One True Way to write this is as a filter that reads from stdin and writes to stdout. Viz:
#!/usr/bin/python3
import sys
sys.stdout.write \ ( "".join(reversed(list(sys.stdin))) )
VoilĂ . :) _______________________________________________ wlug mailing list | wlug(a)list.waikato.ac.nz Unsubscribe: https://list.waikato.ac.nz/mailman/listinfo/wlug