【发布时间】:2021-04-08 21:00:13
【问题描述】:
您好,我是 python 新手,我正在做一个语音助手。
Voice 字符串包含我使用 Speech.recognition 所说的内容。
我正在考虑将 Voice 字符串拆分为一个列表并返回匹配的字符串。
例如:Voice = "嗨,你能在谷歌上研究这个和那个吗?
我以不同的方式问它,但我认为我没有正确地问我在寻找什么。 How to use any string from list as a variable?
Voice_List = Voice.split()
List_A = ["research", "search"]
List_B = ["on google", "using google", "with google"]
Word_A = any_word in Voice_List AND in List_A
Word_B = any_word in Voice_List AND in List_B
webbrowser.get().set(anything between Word_A and Word_B)
【问题讨论】:
标签: python string list split python-webbrowser