资源简介
spider.py:
包括股票名的爬取和网页的爬取
stoke_h.py:
存入Excel文件
stoke_sql.py:
存入数据库
plot.py:
制图及存储图像
stoke_gui.py:
GUI界面
运行:
python stoke_gui.py
![](http://www.nz998.com/pic/71880.jpg)
代码片段和文件信息
# -*- coding: utf-8 -*-
from spider import *
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
def stoke_plot(numyear):
dates=[]
fins=[]
for season in range(14):
url=‘http://quotes.money.163.com/trade/lsjysj_‘+str(num)+‘.html?year=‘+str(year)+‘&season=‘+str(season)
html=request_stoke(url)
soup=bf(html‘lxml‘)
trs=soup.find(class_=‘table_bg001 border_box limit_sale‘).find_all(‘tr‘)
for tr in trs:
tds=tr.find_all(‘td‘)
td=[x for x in tds]
if len(td)>=1:
if td[0]!=‘‘and td[4]!=0:
dates.append(td[0].text)
fins.append(float(td[4].text))
data= dict(map(lambda xy:[xy]datesfins))
dates=sorted(data)
fins=[]
for date in dates:
fins.append(data[date])
font =FontProperties(fname=r“SimHei.ttf“ size=14)
figax = plt.subplots(11)
plt.plot(datesfins)
for label in ax.get_xticklabels():
label.set_visible(False)
for label in ax.get_xticklabels()[::20]:
label.set_visible(True)
plt.xticks(rotation=45)
plt.xlabel(“日期“ fontproperties=font)
plt.ylabel(“收盘价“ fontproperties=font)
plt.title(str(year)+“年“+get_name(num)+“收盘价历史数据“ fontproperties=font)
plt.tight_layout()
plt.savefig(“./pic/“+str(year)+“年“+get_name(num)+“收盘价波历史数据.png“)
plt.show()
if __name__ == “__main__“:
stoke_plot(6013182019)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-07-11 14:57 stoke-spider\
文件 200 2019-07-11 14:57 stoke-spider\readme.md
文件 1515 2019-07-10 15:28 stoke-spider\plot.py
文件 13144 2019-07-09 15:59 stoke-spider\icon.jpg
文件 34304 2019-07-09 16:43 stoke-spider\浦发银行.xls
文件 510 2019-07-09 16:13 stoke-spider\spider.py
文件 26112 2019-07-09 15:34 stoke-spider\中国平安.xls
文件 1339 2019-07-10 14:37 stoke-spider\test.py
文件 2713 2019-07-11 12:06 stoke-spider\stoke_gui.py
文件 39109 2019-07-09 11:56 stoke-spider\2019年中国平安收盘价历史数据.png
文件 9751076 2011-03-10 08:00 stoke-spider\SimHei.ttf
文件 80 2019-07-09 03:46 stoke-spider\.~lock.中国平安.csv#
文件 1976 2019-07-09 14:11 stoke-spider\stoke_h.py
文件 1813 2019-07-09 17:00 stoke-spider\stoke_sql.py
目录 0 2019-07-10 15:30 stoke-spider\pic\
文件 41526 2019-07-10 15:28 stoke-spider\pic\2019年中国平安收盘价波历史数据.png
文件 40008 2019-07-09 16:43 stoke-spider\pic\2018年浦发银行收盘价波历史数据.png
目录 0 2019-07-10 15:29 stoke-spider\__pycache__\
文件 789 2019-07-09 16:15 stoke-spider\__pycache__\spider.cpython-35.pyc
文件 2051 2019-07-10 15:29 stoke-spider\__pycache__\plot.cpython-35.pyc
文件 2047 2019-07-09 14:44 stoke-spider\__pycache__\stoke_h.cpython-35.pyc
文件 1995 2019-07-10 04:12 stoke-spider\__pycache__\stoke_sql.cpython-35.pyc
相关资源
- 一个多线程智能爬虫,爬取网站小说
- 基于Python爬虫爬取天气预报信息
- 顶点小说单本书爬虫.py
- 一个简单的python爬虫
- 豆瓣爬虫;Scrapy框架
- 中国城市经纬度爬虫.ipynb
- 《PYTHON QT GUI快速编程 PYQT编程指南》
- Python爬虫数据分析可视化
- 网站列表信息爬虫
- 百度图片爬虫(python版)
- python爬取小说59868
- 彼岸花网壁纸爬虫
- Python 爬虫小说.ipynb
- 爬虫爬取网易云音乐
- 北邮python爬虫学堂在线
- Python GUI Programming Cookbook
- python简单爬虫
- 爬取58同城二手房信息.py
- 知网爬虫软件(python)
- python爬虫爬取微博热搜
- python爬虫爬取旅游信息(附源码,c
- python爬虫爬取豆瓣电影信息
- 爬取上百张妹子图源码可直接运行
- Python爬虫实战入门教程
- Python 3 Web Development. Beginners Guide
- 网络爬虫(pachong_anjuke.py)
- Python 串口工具源码+.exe文件
- Python-京东抢购助手包含登录查询商品
- python网络爬虫获取景点信息源码
- 用tkinter写的python GUI注册界面
评论
共有 条评论