问题描述
我正在尝试设置一个条件,以便我可以在我的 AI 的声音之间切换,但是我遇到了错误
TypeError: 'int' object is not subscriptable
这是我本节的代码:
def speak(audio):
engine.say(audio)
engine.runAndWait()
def getvoices(voice):
voices = engine.getProperty('voices')
if voice == 1:
engine.setProperty('voice',voice[0].id)
speak ("Jarvis at your service")
if voice == 2:
engine.setProperty('voice',voice[1].id)
speak ("Friday at your service")
有人可以帮忙吗?在 python 3.9 上编码
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)