I am looking for pythonic way to split a sentence into words, and also store the index information of all the words in a sentence e.g
a = "This is a sentence"
b = a.split() # ["This", "is", "a", "sentence"]
Now, I also want to store the index information of all the words
c = a.splitWithIndices() #[(0,3), (5,6), (8,8), (10,17)]
What is the best way to implement splitWithIndices(), does python have any library method that I can use for that. Any method that helps me calculate the indices of the word would be great.