aList = [1, 2, 3, 4, 5, 6, 7, 8, 9] low = 3 high = 7 print filter(lambda x, l=low, h=high: h>x>l, aList) # returns: [4, 5, 6]