I know there are some similar questions up here, but they mostly either want to find the range itself (which uses some libraries, like the example that stackoverflow says is
Your code compares strings, not numbers. I would suggest using tuples instead:
>>> ip_range = [(1,1,0,0), (1,1,255,255)] >>> testip = (1,1,2,2) >>> testip > ip_range[0] and testip < ip_range[1] True >>> testip = (1,3,1,1) >>> testip > ip_range[0] and testip < ip_range[1] False