我的问题是,我可以删除音频文件时,它停止播放声音模块?我已经写了一个代码,但我做不到:
from gtts import gTTS
import os
import playsound
def say(textg):
tts=gTTS(text=textg,lang='en')
tts.save('audio.mp3')
playsound('audio.mp3')
time.sleep(here, what i have to do?)
os.remove('audio.mp3')
我正在使用Python2.7.15
Tags:
playsound
是模块的名称,应改用playsound.playsound
(函数名):在调用
playsound.playsound
之后,程序将等待它完成。你知道吗相关问题 更多 >
编程相关推荐