SHARE
TWEET

Untitled

a guest Dec 12th, 2012 11 Never
  1. import sys
  2. from collections import defaultdict
  3.  
  4. fname = sys.argv[1]
  5. with open(fname) as fin:
  6.     data = defaultdict(list)  
  7.     for line in fin:
  8.         x,y = line.split()
  9.         data[int(x)].append(float(y))
  10.  
  11. for k,v in sorted(data.items()):
  12.     for i,elem in enumerate(v):
  13.         print i,elem
  14.     print
  15.     print
RAW Paste Data
Top