compare_plint.py (627B)
1 #!/usr/bin/python3 2 3 """compare file from littre and file from plint for disagreements""" 4 5 import sys 6 7 plint = open(sys.argv[1]) 8 littre = open(sys.argv[2]) 9 10 while True: 11 l_plint = plint.readline() 12 if not l_plint: 13 break 14 l_littre = littre.readline() 15 w_plint, p_plint = l_plint.split('%') 16 w_littre, p_littre = l_littre.split('%') 17 p_littre = int(p_littre) 18 assert(w_plint == w_littre) 19 w = w_plint 20 if '-' in p_plint: 21 lo, hi = p_plint.split('-') 22 lo = int(lo) 23 hi = int(hi) 24 else: 25 lo = int(p_plint) 26 hi = lo 27 if not (lo <= p_littre <= hi): 28 print ("%s : %d vs %d-%d" % (w, p_littre, lo, hi))