ip - Python Lowest Common CIDR -


say have 2 ips: startip = '63.223.64.0' , endip = '63.223.127.255'

i understand in python netaddr.iprange_to_cidrs(startip, endip) give list of cidr subnets fit between boundaries. however, hoping go one cidr subnet covers if gives few more ips.

i prefer function it, welcome math/logic calculate , turn code.

it looks netaddr.spanning_cidr trick:

in [5]: netaddr.spanning_cidr(['63.223.64.0', '63.223.127.255']) out[5]: ipnetwork('63.223.64.0/18') 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -