目前,我已经编写了一个语音助手的代码,可以用用户的语音进行书写。我使用 pip 中的 python 键盘模块。但是当我执行代码时,它告诉我没有root就无法写入。
代码如下,
elif (t.find("type") != -1):
le = t.find("type") + len("type") + 1
t = t[le:]
try:
print("Typing> ", t)
keyboard.write('' + t+". ")
except:
print("Can't Type")
Run Code Online (Sandbox Code Playgroud)