Function to find port range?

Started by dlots, March 27, 2017, 11:12:32 AM

Previous topic - Next topic

dlots

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),