赞
踩
- from requests import *
- from pygame import *
- init()
- mixer.init()
- response1=get("https://fanyi.baidu.com/gettts?lan=zh&text=你好我是小思语言助手,很高兴见到你&spd=5&source=web")
- print("你好我是小思语言助手,很高兴见到你")
- with open("你好我是小思语言助手,很高兴见到你.mp3","wb") as f:
- f.write(response1.content)
- mixer.music.load("你好我是小思语言助手,很高兴见到你.mp3")
- mixer.music.play()
- while True:
- response=get("https://api.ownthink.com/bot?spoken=%s"%input("来说点什么吧>>>"))
- print(response.json()["data"]["info"]["text"])
- response1=get("https://fanyi.baidu.com/gettts?lan=zh&text=%s&spd=5&source=web"%response.json()["data"]["info"]["text"])
- with open("%s.mp3"%response.json()["data"]["info"]["text"],"wb") as f:
- f.write(response1.content)
- mixer.music.load(response.json()["data"]["info"]["text"]+".mp3")
- mixer.music.play()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。