Lista 07-12: Investigación de todas las ocurrencias

##############################################################################
# Parte del libro Introducción a la programación con Python
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2015 - ISBN 978-85-7522-250-8
# Primera edición - Mayo/2016
# Sitio: http://www.librodepython.com
#
# Archivo: lista\capítulo 07\07.12 - Investigación de todas las ocurrencias.py
# Descripción: Investigación de todas las ocurrencias
##############################################################################

s = "un tigre, dos tigres, tres tigres"
p = 0
while p > -1:
    p = s.find("tigre", p)
    if p >= 0:
        print("Posición: %d" % p)
        p += 1
Haga clic aquí para bajar el archivo