def _parse_ranges ( ranges ) : for txt in ranges : if '-' in txt : low , high = txt . split ( '-' ) else : low , high = txt , txt yield int ( low ) , int ( high )
how to grab a range from a string python
Converts a list of string ranges to a list of [ low high ] tuples .
def _parse_ranges(ranges):
    """ Converts a list of string ranges to a list of [low, high] tuples. """
    for txt in ranges:
        if '-' in txt:
            low, high = txt.split('-')
        else:
            low, high = txt, txt
        yield int(low), int(high)