python3 return a list of indexes of a specific character in a string

Solutions on MaxInterview for python3 return a list of indexes of a specific character in a string by the best coders in the world

showing results for - "python3 return a list of indexes of a specific character in a string"
Giada
31 Jan 2020
1string='mississippi'
2s='s'
3lst= []
4for i in range(len(string)):
5    if (string[i] == s):
6        lst.append(i)
7print(lst)
8#result: [2, 3, 5, 6]
queries leading to this page
find index in list of item with stringlist string how to get a certain index from itpython string findall letters indexshow to get the particular index in a list of string pythonfind all index of char in string pythonpython find all indexes of character in stringpython get string and print the times of indexhow to set the position of a string in pythonfind all characters in string pythonget all indexes of char in string pythonhow to find all char in a string pythonlist of index of char in string pythonfind all indexes of character in list pythonpython find all the indexes of space in a listpython get all indexes of character in stringpython character from indexprint all index of a character in string pythonstring indexing pythonprint character at index pythonhow to print a character at a certain index in pythonfind all index of character in string pythonget all indexes of character in string pythongetting index of a word in list of characters pythonpython string from position to endretrieve all indexes of a character in pythonindex of character in list pythonhow to get all index of a character in string in pythonfind all index of letter in string pythonpython slice part of string with characterfind all indexes of a characters in string pythondifferent ways of finding index of character in list pythonpython int to string indexpython get all indices of character in stringhow to print a string from a specified index boundary in pythonhow to cut string in pythonget index 27s of character in list pythonhow to print a character in a list using its index number pythonfinding all indexes of a specified character within a string pythonpython how to get index evey letterpython find all indexes of character in pythonhow to find the index of a certain char in a python listhow to print certain characters of a string in pythonpython how to check all position of character typespython index of a char the third timeget all index of character in string pythonpython3 return a list of indexes of a specific character in a stringpython get character at indexpython find all index of character in stringpython get string at indexhow to put index in string at the endpython index of character in listpython find all indexes character in stringprint index of character in string pythonprint index of list based on stringget all index of element in string pythonpython string find all index of characterfind all indexes of character in string pythonhow to print certain letters from a string in pythonpython find all indexes of character in string pythonall possible substrings of a string in javahow to get a characters index in a list in pythonpython find all indexes of a char in stringget index of character in list pythonhow to get all characters from a specific index in an array of strings pythonfind index of all character in string pythonhow to find all indexes of a char in a listpython slicing stringsstring at index pythonhow to print specific characters in a string pythonfirst unique character in a stringfind index of all elements in string pythonfind all indexes of a chracter in a string pythonhow to get the index value of a listitem in python if it is matched with a charslicing strings pythonhow to get specific index of a string in pythonhow to index each letter of word in pythonstring python index0python find all elements in stringget id of certain characters in python stringspecific index element from string pythonpython all indexes of charpick a character from a string by index pythonindexing string in inside python listpython3 return a list of indexes of a specific character in a string