find_ranges

find_ranges(data: str | list[int]) str[source]

Identify numeric ranges in string or list.

This utility function takes a string or a list of integers (e.g. spectral window lists) and returns a string containing identified ranges.

Examples: >>> find_ranges([1,2,3]) '1~3' >>> find_ranges('1,2,3,5~12') '1~3,5~12'