import speech_recognition as sr
for index, name in enumerate:(sr.Microphone.list_microphone_names()):
print("Microphone with name \"{1}\" found for `Microphone(device_index={0})`".format(index.name))
Expected expression Pylance (Ln 2, Col 70) (View screenshot (https://ibb.co/6sqffmj))
and SyntaxError: invalid syntax
Please, help me! (I use a translator, if there are any mistakes, I apologize)
(View screenshot (https://ibb.co/6sqffmj))
I tried copying:
print("A microphone named "{1}" was found for Microphone(device_index={0})".format(index.name)))
and paste it in:
for index, name in enumerate:(sr.Microphone.list_microphone_names()):
but it doesn’t work
>Solution :
Try to use the code bellow:
import speech_recognition as sr
for index, name in enumerate(sr.Microphone.list_microphone_names()):
print(f"Microphone with name {name} found for Microphone {index}")
In this example, I removed the excessive double quotes that were in the print function, and added the correct identation to the code. I also used the variables index and name in the most correct way. Let me know if the code works for you.
Best reguards.