strseq

sisl.utils.strseq(cast, s)[source]

Accept a string and return the casted tuples of content based on ranges.

Parameters:

cast: function

parser of the individual elements

s: str

string with content

Examples

>>> strseq(int, '3')
3
>>> strseq(int, '3-6')
(3, 6)
>>> strseq(int, '3:2:7')
(3, 2, 7)
>>> strseq(float, '3.2:6.3')
(3.2, 6.3)