python文字发音

安装python 配置环境变量,使用pip安装pyttsx

# coding=utf-8

#@see http://pyttsx.readthedocs.org/en/latest/engine.html#examples
import pyttsx
engine = pyttsx.init()

#语速
rate = engine.getProperty('rate')
#print rate

#音量
volume = engine.getProperty('volume')
#print volume

engine.setProperty('rate', 100)
engine.setProperty('volume',  2000)

#语音类别
voices = engine.getProperty('voices')
engine.say(u'李洋是逗比')

'''
for voice in voices:
   engine.setProperty('voice', voice.id)
   print voice.id
'''

engine.runAndWait()