![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
异步爬虫-单&&多线程
不停歇向前^-^蜗牛
初来乍道,请多多指教
展开
-
【新发地】python&新旧版翻页
旧版网址:http://www.xinfadi.com.cn/marketanalysis/0/list/1.shtml网页源码案例import requests# from bs4 import BeautifulSoup# # f = open("新发地菜价.csv",mode="w",encoding="utf-8") # 保存文件# url = "http://www.xinfadi.com.cn/marketanalysis/0/list/1.shtml"# resp = req原创 2022-02-08 11:21:40 · 538 阅读 · 0 评论 -
【多线程】python&&组合案例
查看网页源代码"""分析: 进程1. 从主页面当中解析出详情页的url,从详情页中提取到图片的下载地址 进程2. 把拿到的下载地址,进行下载 队列:可以进行进程之间的通信"""from multiprocessing import Process,Queue # 队列Queuefrom concurrent.futures import ThreadPoolExecutorimport requestsfrom lxml import etreefrom url原创 2022-02-07 13:08:59 · 453 阅读 · 0 评论 -
【线程池】python创建
创建线程池from concurrent.futures import ThreadPoolExecutorimport time# def func(name):# for i in range(10):# print(name,i)### if __name__ == '__main__':# with ThreadPoolExecutor(10) as t:# for i in range(100):# t原创 2022-02-07 12:56:03 · 495 阅读 · 0 评论 -
【单线程&多线程】python创建
单线程创建from threading import Thread# 单线程# def func(name):# for i in range(1000):# print(name, i)### if __name__ == '__main__':# func("周某伦")# func("王某宏")# func("周某发")多线程创建写法一# # 创建任务from threading import Thread# def原创 2022-02-07 12:48:08 · 112 阅读 · 0 评论