↧
Answer by Asen for Python: Getting the Index of a list
Just use index()a = "aa bb cc"b = "bb"print a.index(b)If the OP wants it to only count letters:a = "aa bb cc"b = "bb"index_t = a.index(b)real_index = index_t - a[:index_t].count('')
View ArticleAnswer by Sam51 for Python: Getting the Index of a list
Assuming the word only appears once, I'd do it like this:sentence = sentence.split(word)sentence[0] = sentence[0].replace("","")result = len(sentence[0])
View ArticlePython: Getting the Index of a list
I'm trying to create a program that will take input of a sentence and a word and check that sentence for the word and return the index of the beginning of the wordi.e. sentence = "random set of words"...
View Article
More Pages to Explore .....