如何使用语音从另一个python模块访问列表?

2024-03-28 14:55:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用python构建语音助手。但是我有一些问题

我有一个assistantInputs.py文件,它包含单词,还有main.py,它是主程序

以下是我在assistantinput.py中的代码:

hello = ["hi","hey","hello","greetings"]

以下是我在main.py中的代码:

import assistantInputs as aI

if voice_data in aI.hello:
    print("Hey!")

“语音数据”允许我说话并识别我的声音

但它不起作用。我该怎么办?我无法访问hello列表