yuyang4271 最近的时间轴更新
yuyang4271

yuyang4271

V2EX 第 232106 号会员,加入于 2017-05-23 17:41:24 +08:00
yuyang4271 最近回复了
@amazingrise 好的 谢谢你,我试一下
@aquariumm 好的 我试试,谢谢你
@uuspider pip 也试了,报错是网络不可达
@aquariumm 输入的命令是
sudo apt-get install python3-pyttsx3
报错是:无法定位软件包:pyttsx3
@ryonanamizu 嗯 update 过了
import urllib.request
import json
import pyttsx3
import time
import requests
import re
import pyttsx3
m_last = ''
count = 1
url = 'https://btc.com/'
headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36",
"Accept-Encoding":"gzip, deflate, br"}
proxies = {
"https": "https://117.22.42.43:8118",
"http": "http://119.139.197.247:3128",
"http": "http://121.69.37.6:9797",
}
if __name__ == '__main__':
engine=pyttsx3.init()
while True:
time.sleep(1)
count = count + 1
response = requests.get(url,headers=headers,proxies = proxies)
print(response.text)
print(type(response.text))
pattern = re.compile(r'"hash":".{64}","prev_block_ha')
m = pattern.findall(response.text)
m = m[0][8:72]
if (m_last != m):
m_last = m
voice=engine.getProperty('voice')
voices=engine.getProperty('voices')
for item in voices:
print(item.id,item.languages)
engine.setProperty('voice','zh')
engine.say(m)
engine.runAndWait()
if (count >10):
count = 0
voice=engine.getProperty('voice')
voices=engine.getProperty('voices')
for item in voices:
print(item.id,item.languages)
engine.setProperty('voice','zh')
engine.say(m)
engine.runAndWait()
print(m)


这是代码,能帮我看看哪里出错了吗?谢谢
@alexzsh 谢谢
@CEBBCAT 嗯嗯
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   887 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 15ms · UTC 21:46 · PVG 05:46 · LAX 13:46 · JFK 16:46
Developed with CodeLauncher
♥ Do have faith in what you're doing.