Networking-Forums.com

Professional Discussions => Programming Goodies and Software-Defined Networking => Topic started by: dlots on March 27, 2017, 11:12:32 AM

Title: Function to find port range?
Post by: dlots on March 27, 2017, 11:12:32 AM
Hey
Figured I would ask here before I tried to make one:  Anyone have a python function that you can feed a list of ports into and have it spit out the port range?

feed in
gi1/1,
gi1/2,
gi1/3,
gi1/5,
gi1/6,
gi1/7,
gi1/9

get back
gi1/1-3,
gi1/5-7,
gi1/9-9 (or just gi1/9),