fork download
  1. x = 'An apple a day, keeps the doctor away'
  2.  
  3. i, j = x.find('a', 0), []
  4. while i != -1:
  5. j.append(i)
  6. i = x.find('a', i+1)
  7. print(j)
Success #stdin #stdout 0.02s 9984KB
stdin
Standard input is empty
stdout
[3]
[3, 9]
[3, 9, 12]
[3, 9, 12, 33]
[3, 9, 12, 33, 35]