File: py1

package info (click to toggle)
ladr 0.0.200902a-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 11,400 kB
  • ctags: 7,168
  • sloc: ansic: 59,953; perl: 1,006; python: 620; makefile: 403; sh: 86; csh: 58; modula3: 13
file content (45 lines) | stat: -rwxr-xr-x 878 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/python

import sys
import re

size = 0
g1 = []
g2 = []
g3 = []
g4 = []
g5 = []

for line in sys.stdin:

    if re.match(' *\d', line):

        [s, x1, x2, x3, x4, x5, term] = line.split(None, 6)

        if size != 0 and s != size:
            print '----------------------------'
            print '     %2d     %2d     %2d     %2d     %2d' % (len(g1),len(g2),len(g3),len(g4),len(g5)) 
            print '============================'
            g1 = []
            g2 = []
            g3 = []
            g4 = []
            g5 = []
 
        sys.stdout.write(line)
        if x1 not in g1:
            g1.append(x1)
        if x2 not in g2:
            g2.append(x2)
        if x3 not in g3:
            g3.append(x3)
        if x4 not in g4:
            g4.append(x4)
        if x5 not in g5:
            g5.append(x5)
    
        size = s