On 03Jun2015 17:35, richard kappler <[email protected]> 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 ']'?

With the str.find method!

 s = 'a]b]c'
 pos = s.find(']')
 while pos >= 0:
   print("pos =", pos)
   pos = s.find(']', pos + 1)

Obviously you could recast that as a generator funciton yielding positions for general purpose use.

Cheers,
Cameron Simpson <[email protected]>

Serious error.
All shortcuts have disappeared.
Screen. Mind. Both are blank.
- Haiku Error Messages 
http://www.salonmagazine.com/21st/chal/1998/02/10chal2.html
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to