Why is returning Indexerror: list index out of range

Asked

Viewed 26 times

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()```
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.