资源简介
自己做的一个课程设计。含源码,含实验报告!
能够爬取网站的股票信息,
列成一张信息表,保存到txt文件,也可以保存到excel表
虽然感觉有点low,我也是新手,学习中!
精心设计,求好评!
代码片段和文件信息
import urllib
import urllib.request
import re
import random
import time
import xlwt
def set_style(font_namefont_heightbold=False):
style=xlwt.XFstyle()
font=xlwt.Font()
font.name=font_name # ‘Times New Roman‘
font.height=font_height
font.bold=bold
font.colour_index=4
borders=xlwt.Borders()
borders.left=6
borders.right=6
borders.top=6
borders.bottom=6
style.font=font
style.borders=borders
return style
stockFile = open(“stockFile.txt“ “w“)
stockFile.close()
#抓取所需内容
user_agent = [“Mozilla/5.0 (Windows NT 10.0; WOW64)“ ‘Mozilla/5.0 (Windows NT 6.3; WOW64)‘
‘Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML like Gecko) Chrome/23.0.1271.64 Safari/537.11‘
‘Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko‘
‘Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML like Gecko) Chrome/28.0.1500.95 Safari/537.36‘
‘Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; rv:11.0) like Gecko)‘
‘Mozilla/5.0 (Windows; U; Windows NT 5.2) Gecko/2008070208 Firefox/3.0.1‘
‘Mozilla/5.0 (Windows; U; Windows NT 5.1) Gecko/20070309 Firefox/2.0.0.3‘
‘Mozilla/5.0 (Windows; U; Windows NT 5.1) Gecko/20070803 Firefox/1.5.0.12‘
‘Opera/9.27 (Windows NT 5.2; U; zh-cn)‘
‘Mozilla/5.0 (Macintosh; PPC Mac OS X; U; en) Opera 8.0‘
‘Opera/8.0 (Macintosh; PPC Mac OS X; U; en)‘
‘Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080219 Firefox/2.0.0.12 Navigator/9.0.0.6‘
‘Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0)‘
‘Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)‘
‘Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET4.0C; .NET4.0E)‘
‘Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML like Gecko) Maxthon/4.0.6.2000 Chrome/26.0.1410.43 Safari/537.1 ‘
‘Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET4.0C; .NET4.0E; QQBrowser/7.3.9825.400)‘
‘Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0 ‘
‘Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML like Gecko) Chrome/21.0.1180.92 Safari/537.1 LBBROWSER‘
‘Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0; BIDUBrowser 2.x)‘
‘Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML like Gecko) Chrome/20.0.1132.11 TaoBrowser/3.
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 42496 2017-10-19 15:11 newestStockInfo.xls
文件 3053 2017-10-19 15:11 stockFile.txt
文件 7585 2017-10-19 15:17 stockQuiry.py
文件 973824 2018-01-21 12:19 1406402-18寇剑峰Python实验报告.doc
相关资源
- Python爬虫每日抓取必应壁纸
- Python爬虫源码—爬取猫途鹰官方旅游
- python爬取百度搜索新闻,并自动生成
- python爬虫数据可视化分析大作业.zip
- python爬虫--爬取youtobe红人信息
- python简单爬虫抓取网页内容
- python 爬虫源码
- 81个Python爬虫源代码
- python爬虫程序python3.6版本
- python爬虫项目.zip
- Python爬虫教程+游戏+框架全套源码课件
- python爬虫爬取股票评论,调用百度A
- 2018年统计用区划代码和城乡划分代码
- Python爬虫抓取双色球开奖数据保存为
- Python爬虫爬取招聘数据和代码.zip
- Python爬虫爬取链家网,并进行可视化
- Python爬虫:爬取小说站(biqukan.com)网
- python爬虫-scrapy框架
- python爬虫爬取当当网
- PYTHON爬虫示例21345
- python爬虫(爬取新浪微博数据)
- python爬虫百度图片(将网络图片采集
- 新手python爬虫必学案例,爬取豆瓣电
- Python爬虫开发与项目实战-范传辉.pd
- 微信公众号的爬取 Selenium+Chromedriver
- python爬虫爬取小说网源码
- python爬虫源码 :qq音乐歌曲信息爬取
- Python爬虫爬取拉勾网(可视化分析)
- python 爬虫全国大部分城市最低气温爬
- Python爬虫爬取百度百科词条源码
评论
共有 条评论