> The totalizator system allows us to merge or group these four bets as > follows: > > 5 + 7 / 3 / 11 / 7 + 14 / 1 / 9 - $50 ($200 total) I'm still trying to get my head around what you're trying to do, but here's some code:
---------------snip----------------- data = ["5 / 3 / 11 / 7 / 1 / 9 - $50", "7 / 3 / 11 / 7 / 1 / 9 - $50", "5 / 3 / 11 / 14 / 1 / 9 - $50", "7 / 3 / 11 / 14 / 1 / 9 - $50"] pick6 = [{},{},{},{},{},{}] for line in data: amount = int(line.split("-")[1].strip().lstrip("$")) runners = [int(s) for s in line.split("-")[0].split("/")] for x,r in enumerate(runners): qty,amt = pick6[x].get(r,(0,0)) qty += 1 amt += amount pick6[x][r] = (qty,amt) for place in range(6): print "For position ",place for runner in sorted(pick6[place].keys()): bets = pick6[place][runner][0] betamt = pick6[place][runner][1] print " Runner",runner,"has",bets,"bets for $",betamt ---------------snip----------------- Output: For position 0 Runner 5 has 2 bets for $ 100 Runner 7 has 2 bets for $ 100 For position 1 Runner 3 has 4 bets for $ 200 For position 2 Runner 11 has 4 bets for $ 200 For position 3 Runner 7 has 2 bets for $ 100 Runner 14 has 2 bets for $ 100 For position 4 Runner 1 has 4 bets for $ 200 For position 5 Runner 9 has 4 bets for $ 200 Is that anywhere close? -- http://mail.python.org/mailman/listinfo/python-list