Sort stdin input lines and send result to stdout
import sys lines = sys.stdin.readlines() lines.sort() for line in lines: print line,