Skip to content

Instantly share code, notes, and snippets.

@luistung
Last active August 29, 2015 14:01
Show Gist options
  • Save luistung/a8b1e2f62703d9352607 to your computer and use it in GitHub Desktop.
Save luistung/a8b1e2f62703d9352607 to your computer and use it in GitHub Desktop.
文件排序
import sys
lines = []
for line in sys.stdin:
line = line.rstrip()
tokens = line.split('\t')
src, tgt = tokens[0], tokens[1]
lines.append(((src,tgt), line)) #TODO
lines.sort(key=lambda a:a[0])
for _, line in lines:
print line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment