Python几行代码实现英文朗读

Posted by Spoony - 2009.2.7 at 11:19 AM
需要安装 pywin32 模块。
#-*- encoding: gb18030 -*-
import sys
from win32com.client import constants
import win32com.client

speaker = win32com.client.Dispatch("SAPI.SpVoice")
print "在下面输入英文单词或者英文字母,也可以是句子,输完按回车进行下一行输入。"
print "如果想退出按Ctrl+Z"

while 1:
  try:
    s = raw_input()
    speaker.Speak(s)
  except:
    if sys.exc_type is EOFError:
      sys.exit()

Add comment




biuquote
Loading



spoony

Categories

Shared Reading

囧马


Games

Are you interested?

Recent comments

评论 RSS

Archives