我正在用Python在Tropo中创建一个应用程序,我想知道是否可以创建一个本地的小语法。我读过关于外部语法SRGS
和GRXML
的文章,但是我可以在代码中使用Python列表创建一个。下面是我要做的。你知道吗
food = ['cheeseburger', 'hot dog', 'salad']
ask("What food would you like?",
#{'choices': "cheeseburger, hot dog, salad",
{'choices': food,
'attempts':3,
'onChoice': fill,
'onBadChoice': nomatch,
'onTimeout': noinput })
上面的代码可以编译,但当它遇到这个问题时就挂断了。你知道吗
如果您想让Tropo询问来电者“您想要什么食物”,并让他们尝试用“食物”中的一个短语回答3次,请尝试发送以下json响应:
要准确地回答您的问题,您需要了解pythontropo库。我对python不熟悉,但是troto的Java和NodeJS库似乎已经过时了……所以如果python也过时了,那么您将不得不做更多的工作来构建和返回这个JSON对象。你知道吗
根据Tropo文档中的示例:
choices
是一个字符串,而不是一个列表,因此您可以这样做:相关问题 更多 >
编程相关推荐