📅  最后修改于: 2022-03-11 14:45:24.712000             🧑  作者: Mango
import speech_recognition as sr
recognizer = sr.Recognizer()
microphone = sr.Microphone()
with microphone as source:
recognizer.adjust_for_ambient_noise(source)
audio = recognizer.listen(source)
command = recognizer.recognize_google(audio)
print(command)