#!/usr/bin/python3 '''Read lines separated by nulls, and output them in reverse order''' import os import sys sys.path.append(os.path.expanduser('~/lib')) sys.path.append(os.path.expanduser('/usr/local/lib')) #import bufsock import readline0 def main(): '''Main function''' lines = [] for line in readline0.readline0(): lines.append(line) lines.reverse() #output_file = bufsock.rawio(handle=1, mode='wb') for line in lines: os.write(1, line + b'\0') #output_file.write(line + b'\0') main()