python
品尚公益团队
致力于公益软件开发,着力于对人们生活品质的改善、工作效率的提高,愿意将我们参与开发的产品免费提供给需要它的人们,为社会提供更尖端、更人性化的产品和服务,成为行业、乃至世界的领先者;
展开
-
python物流领域应用
物流领域应用原创 2022-09-04 10:29:07 · 963 阅读 · 0 评论 -
python中应对各种机制
python处理机制原创 2022-09-03 19:07:00 · 1342 阅读 · 0 评论 -
python获取职位信息
51job获取完整代码:import requestsfrom bs4 import BeautifulSoupimport datetimeimport jsonimport xlwings as xwfrom selenium import webdriverimport timeimport pandas as pdfrom selenium.webdriver import Chrome, ChromeOptions, ActionChainsfrom selenium.w.原创 2022-02-28 23:31:59 · 1307 阅读 · 1 评论 -
python中获取职位信息
51job爬取完整代码:import requestsfrom bs4 import BeautifulSoupimport datetimeimport jsonimport xlwings as xwfrom selenium import webdriverimport timeimport pandas as pdfrom selenium.webdriver import Chrome, ChromeOptions, ActionChainsfrom selenium.we原创 2021-09-30 21:46:18 · 1067 阅读 · 0 评论 -
基金收益排名
基金收益排名import xlwings as xwimport requestsfrom bs4 import BeautifulSoupfrom datetime import datetimeimport jsonimport xlwtimport xlwings as xwfrom selenium import webdriverimport timeimport pandas as pdimport csvimport refrom selenium.webdriv原创 2022-02-05 14:37:03 · 795 阅读 · 1 评论 -
火狐浏览器驱动下载
Chromedrive下载版本可参照Selenium Chrome版本与chromedriver兼容版本对照表下载地址各版本下载地址geckodriver下载地址淘宝npm镜像geckodriver Mirroriedriver下载地址http://selenium-release.storage.googleapis.com/index.htmlphantomjs驱动下载地址Download PhantomJSoperadriver下载地址淘宝npm镜像Op原创 2022-01-25 14:30:11 · 5520 阅读 · 0 评论 -
python中地图测距
百度地图测距:import requestsfrom bs4 import BeautifulSoupfrom datetime import datetimeimport jsonimport xlwtimport xlwings as xwfrom selenium import webdriverimport timefrom selenium.webdriver import Chrome, ChromeOptionsimport pandas as pdimport js原创 2021-12-04 22:57:12 · 707 阅读 · 0 评论 -
python操作excel
import pandas as pdimport osimport xlwt#文件路径file_dir = r'C:\Users\HONORS\Desktop\进出库'#构建新的表格名称new_filename = file_dir + '\\new_file.xls'#找到文件路径下的所有表格名称,返回列表file_list = os.listdir(file_dir)new_list = []for file in file_list: #重构文件路径 fi.原创 2021-11-06 15:51:12 · 673 阅读 · 0 评论 -
python中异常处理-安装包失败
导入第三方库失败和解调器配置根据字面意思理解,一直以为是pip版本不对导致的,于是花费时间在更新pip版本上。根据导入模块时错误提示信息可以看出,我的pycharm路径为C:\Users\Administrator.USER-20190620KX\PycharmProjects\untitled20\Scripts。在该径路下打开命令窗口,输入python.exe -m pip install matplotlib -i http://pypi.douban.com/simple --trusted-原创 2021-11-06 15:39:07 · 3170 阅读 · 0 评论 -
python中pyecharts的使用
import pyechartsfrom pyecharts.charts import Barfrom pyecharts.charts import Piefrom pyecharts.charts import Linefrom pyecharts import options as optsbar=Bar()bar.add_xaxis(["衬衫","毛衣","裙子","T学",])bar.add_yaxis("A销售",[120,110,30,40,])bar.add_yaxis(.原创 2021-10-08 19:13:52 · 991 阅读 · 0 评论 -
python中完整爬取股票财务信息和公司基本信息含xpath
完整代码:import xlwings as xwimport requestsfrom bs4 import BeautifulSoupfrom datetime import datetimeimport jsonimport xlwtimport xlwings as xwfrom selenium import webdriverimport timeimport pandas as pdimport csvimport refrom selenium.webdrive原创 2021-09-19 13:45:54 · 3982 阅读 · 2 评论 -
python中完整爬取股票财务信息和公司基本信息
完整代码:import xlwings as xwimport requestsfrom bs4 import BeautifulSoupfrom datetime import datetimeimport jsonimport xlwtimport xlwings as xwfrom selenium import webdriverimport timeimport pandas as pdimport csvimport refrom selenium.webdrive原创 2021-09-19 13:45:14 · 2043 阅读 · 3 评论 -
python中爬取网页图片
完整代码:import requestsimport re# 自定义下载页面函数def load_page(url): response = requests.get(url) data = response.content return data# 自定义保存页面图片函数def get_image(html): regx = r'http://[\S]*jpg' # 定义图片正则表达式 pattern = re.compile(regx)原创 2021-09-16 20:14:31 · 4688 阅读 · 0 评论 -
python通过selenium绕过反扒系统跨网页批量获取股票财务信息
完整代码:import xlwings as xwimport requestsfrom bs4 import BeautifulSoupfrom datetime import datetimeimport jsonimport xlwtimport xlwings as xwfrom selenium import webdriverimport timeimport pandas as pdimport csvimport refrom selenium.webdrive原创 2021-09-11 22:19:56 · 498 阅读 · 0 评论 -
python通过selenium获取网页信息可以绕过反扒系统
加载selenium控件:pip intall selenium;pip showseleniumweb下载地址:chrome浏览器,chrome插件,谷歌浏览器下载,谈笑有鸿儒 (chromedownloads.net)https://www.chromedownloads.net/原创 2021-09-10 17:53:34 · 455 阅读 · 0 评论 -
python中网页数据输出到csv操作方法
完整代码:import jsonimport requestsfrom bs4 import BeautifulSoupimport csvimport pandas as pdwith open('web.html','r',encoding='gbk') as f: html=BeautifulSoup(f,'html.parser') html.list=html.find_all('div',attrs={'class':'e'}) # print(html)原创 2021-09-07 15:03:35 · 430 阅读 · 0 评论 -
Python中cookie登录基金账户获取账户金额以追加写入方式导出到excel【心血付出】
好买网完整代码:from unicodedata import decimalimport requestsfrom bs4 import BeautifulSoupfrom datetime import datetimeimport jsonimport xlwtimport xlwings as xw# 新闻链接from numpy.core import doubleurl = ' https://i.howbuy.com/member/property/'sess原创 2021-09-05 16:36:04 · 2669 阅读 · 0 评论 -
python中模拟登录网址含验证码
完整代码:# -*- coding: UTF-8 -*-import jsonimport requestsimport sysfrom bs4 import BeautifulSoups = requests.Session()class JD: def __init__(self, username, password): self.username = username self.password = password s原创 2021-09-05 09:32:19 · 750 阅读 · 0 评论 -
关于cookielib和urllib2无法安装问题
cookielib操作from http import cookiejarcookielib=cookiejar.CookieJar()原创 2021-09-05 09:09:48 · 300 阅读 · 0 评论 -
python中登录基金账户获取基金数据
完整代码:from lxml.html import fromstringfrom bs4 import BeautifulSoupimport xlwtimport jsonwith open('rr.html' ,'r' ,encoding='utf-8') as f: # Soup = BeautifulSoup(f, 'lxml') html = BeautifulSoup(f, 'html.parser') html.list=html.find_all(原创 2021-09-04 22:20:02 · 976 阅读 · 0 评论 -
python中模拟点击
完整代码:import timefrom selenium import webdriver# sys.setProperty("webdriver.chrome.driver", "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chromedriver.exe");wd = webdriver.Chrome('C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome原创 2021-09-04 18:39:42 · 150 阅读 · 0 评论 -
python模拟登录保存并读取cookie
完整代码:在这里要感谢一下博客楼主的辛勤付出,给的账户和密码都是真实的,楼主很伟大;博客来源:https://blog.csdn.net/weixin_46192930/article/details/105135087完整代码:from urllib import requestfrom urllib import parsefrom http.cookiejar import CookieJarfrom urllib import requestfrom http.cook原创 2021-09-04 17:41:04 · 1391 阅读 · 0 评论 -
python中模拟登录获取cookie并保存
完整代码:#!/usr/local/bin/python3.7"""@File : cookiejar_login.py@Time : 2020/04/05@Author : Mozili"""import urllib.requestimport urllib.parse# cookiejar用来保存cookieimport http.cookiejar# 创建一个cookiejar对象cj = http.cookiejar.CookieJar原创 2021-09-04 15:38:00 · 1006 阅读 · 0 评论 -
python中利用cookie免登录获取网页
完整代码:from bs4 import BeautifulSoupimport urllib.request as urlliburl = 'https://book.douban.com/'cookie=''headers = { 'Host':'www.douban.com', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.原创 2021-09-04 13:07:03 · 268 阅读 · 0 评论 -
python爬取安居客住房数据,同样request和beautifulSoul
request方法:import jsonimport requestsfrom lxml import etreeimport xlwings as xwimport re# 爬取网址url ="https://hz.zu.anjuke.com/?from=navigation"# 模拟浏览器访问headers =headers={'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/\537.36 (KH原创 2021-09-03 21:38:06 · 601 阅读 · 0 评论 -
python爬取新闻输出到json生成xlsx文件-3完整调取
完整代码:import requestsfrom bs4 import BeautifulSoupfrom datetime import datetimeimport jsonimport xlwings as xwimport xlwtdef get_list(url): # 新闻链接 res = requests.get(url) res.encoding = 'utf-8' # 完整HTML # html = BeautifulSoup(re原创 2021-09-03 18:28:50 · 155 阅读 · 0 评论 -
python爬取新闻输出到json生成xlsx文件-2爬取长篇文章
完整代码:import requestsfrom bs4 import BeautifulSoupfrom datetime import datetimeimport jsonimport xlwings as xw# 新闻链接url="http://news.sina.com.cn/c/2020-10-19/doc-iiznctkc6335371.shtml"res = requests.get(url)res.encoding = 'utf-8'# 完整HTML# html原创 2021-09-03 17:29:00 · 136 阅读 · 0 评论 -
python爬取新闻输出到json生成xlsx文件-1
安装包:pip install beautifulsoup4完整代码:import requestsfrom bs4 import BeautifulSoupfrom datetime import datetimeimport jsonimport xlwings as xw# 新闻链接url="https://news.sina.com.cn/world/"res = requests.get(url)res.encoding = 'utf-8'# 完整HTML# h原创 2021-09-03 16:33:49 · 134 阅读 · 0 评论 -
完整python爬取网页数据写入excel保存xlsx格式
完整代码:import jsonimport requestsfrom lxml import etreeimport xlwings as xwurl="https://shenzhen.baixing.com/jiudianfuwu/m35936-m5238/"headers={'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/\537.36 (KHTML, like Gecko) Chrome/86.0.4原创 2021-09-02 20:57:27 · 2428 阅读 · 0 评论 -
完美解决python爬取网页数据导json然后输出到excel.xlsx
代码:import jsonimport xlwtperson_data=[]#定义数组#数组赋值person_data.append({ '序号':1,'name':"小王",'age':12})#输入jsonwith open('person_data.json','w',encoding='utf-8') as f: json.dump(person_data,f,indent=1,ensure_ascii=False)# 创建一个excel对象book =原创 2021-09-02 10:08:57 · 1409 阅读 · 0 评论 -
python打开txt文件
读取文本文件操作# f = open('/Users/lemonlxn/Desktop/test/files/文本.txt',mode='r',encoding='utf-8')## data = f.read()# print(data)## f.close()# with open('files/文本.txt',mode='r',encoding='utf-8') as f:# data = f.readlines()# print(data[0])wit原创 2021-09-01 21:25:46 · 3556 阅读 · 0 评论 -
python操作excel
新建excelimport xlwings as xwapp=xw.App(visible=True,add_book=False)for dept in ("技术部","开发部","销售部"): workbook=app.books.add() workbook.save(f"./部门业绩-{dept}.xlsx")原创 2021-09-01 19:28:06 · 259 阅读 · 0 评论 -
python导出到excel实例
导入xlwt导入datetime完整代码模块:import xlwtimport datetimeimport datetime as datetimestyle0 = xlwt.easyxf('font: name Times New Roman, color-index red, bold on', num_format_str='#,##0.00')style1 = xlwt.easyxf(num_format_str='D-MMM-YY')wb = xlwt.Work原创 2021-09-01 08:23:56 · 171 阅读 · 0 评论 -
python中简单爬取网页代码
简单网页制作:<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>我要自学网</title></head><body> <h1一级标题1>这是一级标题</h1一级标题1> <h2>这是二级标题</h2> <p>这是一段原创 2021-08-31 22:10:35 · 1075 阅读 · 0 评论 -
python获取网页信息
导入工具包win+r;输入cmd;输入pip install BeautifulSoup4输入pip install requests主页代码:import requests# 导入bs4套件from bs4 import BeautifulSoupnewsurl = 'http://www.baidu.com/'# 发送get请求res = requests.get(newsurl)# 设置网页编码格式,如果不设置的话会产生中文乱码,编码格式按照爬取得网页来设置re.原创 2021-08-31 09:35:28 · 186 阅读 · 0 评论