¿Hay alguna manera Pythonic (Sé que puedo bucle que utiliza rango (len (..)) y obtener un índice) para hacer el siguiente ejemplo:de bucles en Python
for line in list_of_strings:
if line[0] == '$':
while line[-1] == '#':
# read in the Next line and do stuff
# after quitting out of the while loop, the next iteration of the for loop
# should not get any of the lines that the while loop already dealt with
esencialmente, al mismo tiempo anidado loop debería estar incrementando el ciclo for.
Editar: No es un identificador de archivo, confundido dos cosas las que estaba trabajando, que es una lista de cadenas
Use line.startswith y line.endswith en lugar de línea [0] y línea [-1]. Funciona bien con líneas vacías. Y también se ve mejor :). – utdemir
@utdemir: alucinado, he estado haciendo tantos controles para 'len (línea)> 0' – pseudosudo