摘要: 1. 多线程 不带参数 from threading import Thread def func(): for i in range(100): print('函数', i) if __name__ == '__main__': #主程序 t = Thread(target=func)# 创建多线 阅读全文
posted @ 2022-05-05 11:44 我在春天等伱 阅读(271) 评论(0) 推荐(0)
摘要: 网址 : https://desk.zol.com.cn/bizhi/9911_119095_2.html 1. 爬取网站图片代码 无下载 import requests import re import json url = 'https://desk.zol.com.cn/bizhi/9911_ 阅读全文
posted @ 2022-05-05 10:57 我在春天等伱 阅读(118) 评论(0) 推荐(0)
摘要: 爬取快手视频代码: import requests import json import re # 输入你想要的搜索关键词 key = input('输入你搜索的关键词:') # range(0, 3) -> 0 1 2 抓取, 3表示结束不抓取 for pcursor in range(0, 3) 阅读全文
posted @ 2022-05-04 17:17 我在春天等伱 阅读(1102) 评论(0) 推荐(0)
摘要: 视频简单下载 import requests url = 'https://sod.bunediy.com/20220413/liDEn1sp/index.m3u8' # https://sod.bunediy.com/20220413/liDEn1sp/index.m3u8 reps = requ 阅读全文
posted @ 2022-05-03 08:21 我在春天等伱 阅读(275) 评论(0) 推荐(0)
摘要: 小说 : #https://dushu.baidu.com/api/pc/getCatalog?data={"book_id":"4306063500"} #https://dushu.baidu.com/api/pc/getChapterContent?data={"book_id":"43060 阅读全文
posted @ 2022-05-02 13:08 我在春天等伱 阅读(170) 评论(0) 推荐(0)
摘要: 代码 : import asyncio import aiohttp urls = [ 'https://img.lianzhixiu.com/uploads/210304/37-21030410123B61.jpg', 'https://img.lianzhixiu.com/uploads/210 阅读全文
posted @ 2022-05-02 09:50 我在春天等伱 阅读(45) 评论(0) 推荐(0)
摘要: 简单 案例模板 import asyncio async def domwlpad(url): print('开始下载') await asyncio.sleep(2) # 网络请求 print('下载完成') async def main(): urls = [ 'www.baidu1.com', 阅读全文
posted @ 2022-04-30 08:24 我在春天等伱 阅读(125) 评论(0) 推荐(0)
摘要: 1. 线程池使用 注意 : ProcessPoolExecutor 进程池 不好用 同进程一样 from concurrent.futures import ThreadPoolExecutor,ProcessPoolExecutor def fn(name): for i in range(10) 阅读全文
posted @ 2022-04-28 13:16 我在春天等伱 阅读(51) 评论(0) 推荐(0)
摘要: 1. 方法一: 多线程 # 多线程 需要组件from threading import Threaddef func(): for i in range(100): print('fun', i)if __name__ == '__main__': # 开始使用线程 # 1. 实例化一个进程, 安排 阅读全文
posted @ 2022-04-28 11:29 我在春天等伱 阅读(113) 评论(0) 推荐(0)
摘要: 0. ip更换 import requests url = 'https://www.baidu.com' # 代理ip proxies = { 'https':'218.1.1.1:3308' } reps = requests.get(url, proxies=proxies) print(re 阅读全文
posted @ 2022-04-28 09:36 我在春天等伱 阅读(122) 评论(0) 推荐(0)