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


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
微笑得意调皮害羞酷大笑惊讶发呆喜欢可怜尴尬闭嘴噘嘴皱眉伤心抓狂呕吐坏笑漫骂发怒
Loading




spoony

Categories

Shared Reading

Are you interested?

Recent comments

Comment RSS

Archives


耍宝