Python Demo 01
来源:互联网 发布:中科院 网络空间安全 编辑:程序博客网 时间:2024/05/21 17:22
Python Demo
import numpy as npimport pandas as pdfrom pandas_datareader import data, wbimport requestsfrom bs4 import BeautifulSoup# http://quote.eastmoney.com/sz002026.htmlheader = { 'Connection': 'Keep-Alive', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Language': 'zh-CN,zh;q=0.8,en;q=0.6', 'User-Agent': 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0)'}# fund_url = 'http://fund.eastmoney.com/f10/000001.html'share_url = 'http://quote.eastmoney.com/sz002026.html'res = requests.get(share_url, headers=header, timeout=10)# ISO-8859-1# var = res.encoding# print(var)# re = res.text.encode("gbk")# print(res.text)res.encoding = 'gbk'f = open(r'C:\Users\want\Desktop\sz002026.html', 'w', encoding='gbk')f.write(res.text)f.close()soup = BeautifulSoup(res.text, 'html.parser')# print(soup)# fund_name = soup.html.head.title.string## print(fund_name)share_name = soup.find('h2', id="name").stringshare_code = soup.find('b', id="code").stringprint(share_name)print(share_code)jk = soup.find('td', id="gt5").stringprint(jk)
阅读全文
0 0
- Python Demo 01
- python demo
- Python demo
- Python Demo
- Python Template Demo
- Python lib demo
- CentOS thrift python demo
- python文件读写demo
- Python抓取图片Demo
- python下载文件DEMO
- python-金融数据处理demo
- python selenium使用demo
- python socket通信demo
- python 常用demo
- python function definitioni demo
- dictionary in python demo
- python tuple demo
- python multiple assignment demo
- 需求性质:什么是伴生性需求
- js中的apply和call函数
- 阿里巴巴Json工具-Fastjson讲解
- 总结:java设计模式------策略模式
- js获取起止日期的长度天数
- Python Demo 01
- 最会撩妹的程序猿
- 23种设计模式之状态模式
- TLS, SSL, and HTTPS 升级
- C# 加密与解密
- C语言之--umask()函数
- 网络编程案例---新闻发布系统
- PHP学习笔记——使用array()声明数组
- H5 18