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
请帮我!(本人使用翻译,如有错误请见谅)
(查看截图(https://ibb.co/6sqffmj))
Microphone(device_index={0})
我尝试复制: print("为".format(index.name)))找到名为 "{1}" 的麦克风并将其粘贴到: for index, name in enumerate:(sr.Microphone.list_microphone_names()):但它不起作用
尝试使用以下代码:
在此示例中,我删除了 print 函数中过多的双引号,并向代码中添加了正确的标识。我还以最正确的方式使用了变量索引和名称。让我知道该代码是否适合您。
最好的问候。