我正在尝试为我的ICT课程编写个人助理。我是python的初学者,我尝试过教程,但在使用SyntaxError
时我得到except
。
这是剧本:
try:
command = r.recognize_google(audio)
print ('Your command was: ' + command + '/n'
#loop back ca sa asculte pentru comenzi daca nu gaseI'ste recon speech
except sr.UnknownValueError:
assistant(myCommand())
这就是错误:
File "/Users/dumitruvictor/Desktop/Assistant.py", line 31
except (sr.UnknownValueError:
^
SyntaxError:语法无效
操作系统:Mac OS X
答案 0 :(得分:0)
您需要关闭括号并在except
:
except sr.UnknownValueError:
assistant(myCommand())) # close parentheses, indent this line