Hi Michael, thanks for responding. I actually don't use a method to get
each bin... the bin outputs are nested in the loop. Here's my code:

data_file = open('G:\file.txt')
DUMMY = 9999
bintm = DUMMY
for line in data_file:
    fields = line.strip().split()
    if not line: continue
    ilist = [int(time), int(a)]
#    print "ilist:", ilist
    klock, a = ilist
    newbintm = ((klock + 4) // 5 * 5 ) % 2400
    print "bintm = %d, newbintm = %d, a = %d" % (bintm, newbintm, a)
# the above is the raw data and now the bin loop
    if bintm == 9999:
        bintm = newbintm
        binlo = a
    elif bintm == newbintm:
        binlo = min(binl, t)
    else:
        print "  ==>> %04d %2d" % (bintm, binl) ## this is the bin
        bintm = newbintm
        binl = a

#-------------------

the input file is in my first post in this thread, the output looks
like:

bintm = 9999, newbintm = 1235, a = 23
bintm = 1235, newbintm = 1235, a = 25
bintm = 1235, newbintm = 1235, a = 26
bintm = 1235, newbintm = 1240, a = 22
   ==>> 1235 23
bintm = 1240, newbintm = 1240, a = 31
bintm = 1240, newbintm = 1240, a = 35

#---------------------

I'm not sure where I could create the new list without it getting
overwritten in the bin loop. Confused as to how to add the append
method in a for loop without a defined method for the current bin.
Anyway, I'll keep at it, but I'm not sure how to execute it. Thank you
very much for your suggestion.

Marcus

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to