Ok, thanks Michael, I got it sorted out now. It was just a question of placing the append statement and the new list in the right place. I also added a delete command so the list doesn't become too huge, especially when there's no need to keep it. Here's the corrected code:
if bintm == 9999: bintm = newbintm binlo = a lastbinlo = [binlo] ## new bin creation elif bintm == newbintm: binlo = min(binl, t) else: if len(lastbinlo) > 1: ## check for append data del lastbinlo(0) ## delete extras lastbinlo.append(binlo) ## append new data here print lastbinlo[-2] print " ==>> %04d %2d" % (bintm, binl) ## this is the bin bintm = newbintm binlo = a Anyway, many thanks to everyone who helped with this code. Best regards, Marcus -- http://mail.python.org/mailman/listinfo/python-list