okay, I try you suggestion, and re-write my code like this: colors = ["#ff0000", "#00FF00", "#0000FF"] colorIndex = 0
def getText(nodelist): for str in strings: print colors[colorIndex % colors.length] colorIndex += 1 but i get this error: print colors[colorIndex % colors.length] UnboundLocalError: local variable 'colorIndex' referenced before assignment -- http://mail.python.org/mailman/listinfo/python-list