📜  pyttsx3 保存到文件 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:33.027000             🧑  作者: Mango

代码示例2
import pyttsx3
from gtts import gTTS

engine = pyttsx3.init(driverName='sapi5')
infile = "tanjil.txt"
f = open(infile, 'r')
theText = f.read()
f.close()

#Saving part starts from here 
tts = gTTS(text=theText, lang='en')
tts.save("saved_file.mp3")
print("File saved!")