richard kappler wrote:

> Perhaps the better way for me to have asked this question would have been:
> 
> How can I find the location within a string of every instance of a
> character such as ']'?

>>> import re
>>> s = "alpha]beta]gamma]delta"
>>> [m.start() for m in re.finditer(r"]", s)]
[5, 10, 16]

But do you really need these locations? Why not just split() as in 

>>> s.split("]")
['alpha', 'beta', 'gamma', 'delta']


_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to