Fix Python – Find the nth occurrence of substring in a string

This seems like it should be pretty trivial, but I am new at Python and want to do it the most Pythonic way.
I want to find the index corresponding to the n’th occurrence of a substring within a string.
There’s got to be something equivalent to what I WANT to do which is
mystring.find(“substring”, 2nd)
How can you achieve this in Python?
….

Fix Python – How to extract the substring between two markers?

Let’s say I have a string ‘gfgfdAAA1234ZZZuijjk’ and I want to extract just the ‘1234’ part.
I only know what will be the few characters directly before AAA, and after ZZZ the part I am interested in 1234.
With sed it is possible to do something like this with a string:
echo “$STRING” | sed -e “s|.*AAA\(.*\)ZZZ.*|\1|”

And this will give me 1234 a….