Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import sys
- currId = None
- currXs = []
- currYs = []
- id = None
- for line in sys.stdin:
- line = line.strip()
- print line
- ln = line.split('\t')
- id = ln[0]
- if str(currId) == str(id).replace(" ",""):
- currXs.append(int(ln[1]))
- currYs.append(int(ln[2]))
- else:
- if currId:
- centerX = sum(int(currXs))/len(currXs)
- centerY = sum(int(currYs))/len(currYs)
- print centerX," ",centerY
- currId = id
- currXs.append(int(ln[1]))
- currYs.append(int(ln[2]))
- if str(currId) == str(id).replace(" ",""):
- centerX = sum(currXs)/len(currXs)
- centerY = sum(currYs)/len(currYs)
- print centerX," ",centerY
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement