Is there a function of ipaddress to get the subnet only from input like 192.168.1.129/25

Rob Gaddi rgaddi at highlandtechnology.invalid
Tue Oct 17 13:36:37 EDT 2017


On 10/17/2017 09:59 AM, Daniel Flick wrote:
> I am very new to Python and have been struggling to find some info on processing IP addresses.
> 
> get_network returns 192.168.1.128/25 but I need 192.168.1.128 only.  I can do this with netaddr but I am working with Mako templates and ipaddress is a built in module so there are less dependencies.
> 
> Any ideas?
> 

You mean, other than .split('/')?

-- 
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.



More information about the Python-list mailing list