vak.common.converters.range_str#

vak.common.converters.range_str(range_str, sort=True)[source]#

Generate range of ints from a formatted string, then convert range from int to str

Examples

>>> range_str('1-4,6,9-11')
['1','2','3','4','6','9','10','11']

Takes a range in form of “a-b” and returns a list of numbers between a and b inclusive. Also accepts comma separated ranges like “a-b,c-d,f” which will return a list with numbers from a to b, c to d, and f.

Parameters:
  • range_str (str) – of form ‘a-b,c’, where a hyphen indicates a range and a comma separates ranges or single numbers

  • sort (bool) – If True, sort output before returning. Default is True.

Returns:

list_range – of integer values converted to single-character strings, produced by parsing range_str

Return type:

list