How to extract a string between 2 other strings in python?

Viewed 27228

Like if I have a string like str1 = "IWantToMasterPython"

If I want to extract "Py" from the above string. I write:

extractedString = foo("Master","thon")

I want to do all this because i am trying to extract lyrics from an html page. The lyrics are written like <div class = "lyricbox"> ....lyrics goes here....</div>.

Any suggestions on how can I implement.

5 Answers
Related