Skip to content

Instantly share code, notes, and snippets.

@ntlk
Last active December 25, 2015 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ntlk/6967437 to your computer and use it in GitHub Desktop.
Save ntlk/6967437 to your computer and use it in GitHub Desktop.
sort tool imagined in python
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-r', action='store_const', const=True, required=False)
args = parser.parse_args()
lines = sys.stdin.readlines()
lines.sort(reverse = args.r)
for line in lines:
sys.stdout.write(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment