V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  yuyang4271  ›  全部回复第 1 页 / 共 1 页
回复总数  8
@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   ·   实用小工具   ·   5533 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 27ms · UTC 06:43 · PVG 14:43 · LAX 22:43 · JFK 01:43
Developed with CodeLauncher
♥ Do have faith in what you're doing.