时间:2022-03-07 08:51:48 | 栏目:Python代码 | 点击:次
如下所示:
import pyttsx3 import io import sys sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') engine = pyttsx3.init() engine.setProperty('voice', 'zh') f = open("result.txt", 'r') line = f.readline() while line: line = f.readline() engine.say(line) engine.runAndWait() f.close()