0
Does anyone know why you’re making this mistake
Traceback (Most recent call last): File "c: Users David Pythons Files that speaks main.py", line 194, in Take_query() File "c: Users David Pythons Files that speaks main.py", line 176, in Take_query termo_da_search = term[1] Indexerror: list index out of range
When you say "fetch 'bla bla' "?
termo = query.split('buscando')
termo_da_pesquisa = termo[1]
speak(f'Pesquisando por {termo[1]} no wikipedia')
speak('Agora estamos buscando conteúdo dela')
print(f'Fonte: {pesquisa.url}')
speak(pesquisa.content)
elif 'buscar por' in query:
termo = query.split('buscando')
termo_da_pesquisa = termo[1]
speak(f'Pesquisando por {termo[1]} no wikipedia')
speak('Agora estamos buscando conteúdo dela')
print(f'Fonte: {pesquisa.url}')
speak(pesquisa.content)
except sr.UnknownValueError:
speak('Não entendi')
if __name__ == '__main__':
Take_query()```
Because probably some of the searched values do not divide by the word "searching" used in the split, then the "array" does not have 2 values, only one, so you will not be able to access the Indice 2,: Why it occurs and how to resolve an error of "out of Bounds" or "out of range" or something of type?
– Guilherme Nascimento