To expand on the above, answering the OP's second question: the numeric
value is len( s ).
If the repetitive process is required, try a loop like:
>>> start_index = 11 #to cure the issue-raised
>>> try:
... s[ start_index:s.index( '.', start_index ) ]
... except ValueError:
... s[ start_index:len( s ) ]
...
'gamma'
However, if the objective is to split, then use the function built for
the purpose:
>>> s.split( "." )
['alpha', 'beta', 'gamma']
(yes, the OP says this won't work - but doesn't show why)
If life must be more complicated, but the next separator can be
predicted, then its close-relative is partition().
NB can use both split() and partition() on the sub-strings produced by
an earlier split() or ... ie there may be no reason to work strictly
from left to right
- can't really help with this because the information above only shows
multiple "." characters, and not how multiple separators might be
interpreted.
A straight-line approach might be to use maketrans() and translate() to
convert all the separators to a single character, eg white-space, which
can then be split using any of the previously-mentioned methods.
If the problem is sufficiently complicated and the OP is prepared to go
whole-hog, then PSL's tokenize library or various parser libraries may
be worth consideration...
--
Regards,
=dn