python | gtts 将文字转化为语音内容

来源:互联网 发布:航天开票软件升级 编辑:程序博客网 时间:2024/05/21 09:08
子:
from gtts import gTTSimport ostts = gTTS(text='您好,您吃早饭了吗?需要我给你推荐些吃的吗?', lang='zh-tw')tts.save("hello.mp3")os.system("mpg321 hello.mp3")

执行成功后,结果为1,然后去目录下打开hello.mp3