自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(9)
  • 收藏
  • 关注

原创 request提取value

import requestsimport timefrom lxml import etreeurl=“https://www.baidu.com/”x=’//*[@id=“su”]/@value’res=requests.get(url)#html=res.text #乱码#html=res.text() #TypeError: ‘str’ object is not callable#html=res.read() #AttributeError: ‘Response’ object

2020-12-29 10:47:24 417

原创 异步爬虫排序

from multiprocessing import Poolimport timet1=time.time()from lxml import etreeimport aiohttpimport asynciodef inputme(s,r): #记事本,输入内容 f=open(r,'a+') f.writelines(s) f.write('\n')urls=['https://www.xinshuhaige.com/34953/{}.html'.forma

2020-12-28 22:09:00 405

原创 关于异步爬虫排序的困惑:x固定不变

import asynciofrom asyncio import tasksimport aiohttp #pip install aiohttpfrom lxml import etreefor x in range(498232,498242): async def fetch(session,url): async with session.get(url) as response: html=await response.text() .

2020-12-26 16:50:13 271

原创 单个音乐成功下载

我发觉有这个下载图标的标志,都无法采用类似以下的代码成功下载看到1kb就知道失败了,怎么破?import requestsurl="https://isure.stream.qqmusic.qq.com/C400002rp4Om3qwuGq.m4a?guid=4032175440&vkey=AED5DD1BE83D6D839AA1679D6721D9F096E0969821A87F39C37A6841767FAD230127CF22FBC5E24FE6A171A4CD8785A83B30.

2020-12-24 20:38:12 699 3

原创 EXCEL-VBA批量规范姓名

整改前:操作方法:ALT+F11,输入以下代码Sub 按行按列赋值()r = 1'i:行For i = 1 To 13'j:列 For j = 3 To 12Cells(i, j) = Cells(r, 1)r = r + 1 NextNextEnd SubSub 批量规范姓名()For i = 1 To 13 For j = 3 To 12'批量修改4字姓名的字体大小If Len(Cells(i, j)) = 4 Then Cells(i, j).Font.S

2020-12-22 21:20:42 245

原创 py打包的exe如何自删

py打包的exe如何自删一、1.pyimport win32apiwin32api.ShellExecute(0, 'open', '1.bat', '', '', 0)二、pyinstaller -F 1.py,生成1.exe三、txt转battimeout /t 5 && del /F /S /Q 1.exe这个估计只有忽悠外行的,将1.exe与1.bat放同一处,,运行1.exe才生效。应该改良为1.exe自行生成1.bat,再运行1.bat可能有效。...

2020-12-17 22:34:12 573

原创 仿制PyCharm生成字典的功能

PyCharm收费是有理由的,VSCode就无此功能。不过可以自己写一个用。import reheaders_str="""i:you son of a bitchfrom:auto"""pattern='^(.*?):(.*)$'for line in headers_str.splitlines(): print(re.sub(pattern,'\'\\1\':\'\\2\',',line))运行效果如下图:代码摘自:https://v.youku.com/v_..

2020-12-13 22:54:02 189

原创 selenium判断某元素是否存在

from selenium import webdriverfrom selenium.common.exceptions import NoSuchElementExceptionimport timedriver=webdriver.Edge('k:/zhusc/msedgedriver.exe')url="https://www.bing.com/"driver.get(url)driver.maximize_window() #窗口最大化time.sleep(3)def isElem

2020-12-12 17:41:56 150

原创 批量提取微软必应图片

from time import altzonefrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import Byfrom selenium import webdriverfrom bs4 import BeautifulSoupimpo

2020-12-05 22:59:20 458

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除