【发布时间】:2016-12-05 17:16:35
【问题描述】:
我什至不知道如何用语言来解释我要做什么,所以我将使用示例:
我想在一个字符串中使用一组选项,像这样(如果这样更容易,格式可以改变):
is (my|the) car (locked|unlocked) (now)?
并让它吐出以下字符串列表:
is my car locked
is the car locked
is my car unlocked
is the car unlocked
is my car locked now
is the car locked now
is my car unlocked now
is the car unlocked now
我需要能够为 Alexa 应用程序执行此操作,因为它不接受用于自然语言处理的正则表达式(为什么!?)。
提前致谢。
【问题讨论】:
-
你“可以使用的是{0}汽车{1}锁定{2}吗?”.format(a, b, c)