I'm doing a program that seeks functions throws me this problem:
while lista[a] != (' ' or '' or '\n' or '\t' ):
IndexError: list index out of range
The whole program is this:
def look_for_def (lista):
i = 0
a = 0
func = ''
defi = []
while i < len(lista):
if (lista[i] =='d') and (lista[i + 1] =='e') and (lista[i + 2] == 'f') \
and (lista[i + 3] == ' '):
a = i + 3
while lista[a] == ' ':
a += 1
while lista[a] not in {' ', '' ,'\n', '\t'}:
func += lista[a]
a += 1
defi.append(func)
func = ''
i += 1
return defi
An entry text would be ['d', 'e', 'f', '', 'f', 'u', 'c', 't']
The text that should come out would be ['funct']
Thank you very much!