Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

all the positions of a letter occurrences in a string python

s = 'Apples are totally awesome'

l = [idx for idx, item in enumerate(s.lower()) if 'a' in item]
print(l)
#output: [0, 7, 14, 19]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #positions #letter #occurrences #string #python
ADD COMMENT
Topic
Name
4+1 =