irfpy.util.options
¶
Misc function related to option handling.
Code author: Yoshifumi Futaana
- irfpy.util.options.str2range(str)[source]¶
String conversion to a range list
- Parameters:
str – String expression of range. “-” or “,” separation allowed.
- Returns:
List of the range. See example below.
For example, if str=”1-3”, the returned is [1,2,3]. If str=”1-3,7,9-12”, the returned is [1,2,3,7,9,10,11,12]. Negative value, float value not supported.
>>> print(str2range("1-3")) [1, 2, 3] >>> print(str2range("0-3,7-8,13")) [0, 1, 2, 3, 7, 8, 13]