python抓取股票信息_Python抓取股票Python股票信息捕捉~,python

该Python程序从fx678.com网站抓取外汇汇率信息,并使用requests库下载数据,lxml库解析HTML,队列和matplotlib进行数据处理和可视化。通过分析历史数据,程序展示了如何绘制汇率变化图表。
摘要由CSDN通过智能技术生成

#-*-coding:utf-8 -*-

importurllibimportreimportjsonimporturllib2from lxml importetreeimportrequestsimporttimefrom Queue importQueueimportmatplotlib.pyplot as plt

URL= 'http://quote.fx678.com/exchange/WH'nation_que=Queue()

nation=Queue()

high=Queue()

start_time=Queue()

Chart=[]def __cmp__(self, other):if self.time

elif self.time ==other.time:return0else:return 1

classShare:def __init__(self,time,score):

self.time=time

self.score=scoredef __getitem__(self, key):

self.item.get(key)def __cmp__(self, other):returncmp(self.time, other.time)def __str__(self):return self.time + " " +str(self.score)def download(url, headers, num_try=2):while num_try >0:

num_try-= 1

try:

content= requests.get(url, headers=headers)returncontent.textexcepturllib2.URLError as

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值