会员
周边
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
chenlight
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
7
8
9
10
11
12
13
14
15
···
26
下一页
2025年12月29日
python:playwright的基本使用
摘要: from playwright.sync_api import sync_playwright with sync_playwright() as p: for browser_type in [p.chromium,p.firefox,p.webkit]: browser = browser_ty
阅读全文
posted @ 2025-12-29 08:59 chenlight
阅读(244)
评论(0)
推荐(0)
2025年12月28日
使用 webdriver-manager配置geckodriver
摘要: 使用 webdriver-manager 来自动管理 geckodriver(无需手动下载、配置环境变量),这是 Selenium 自动化中更高效、更省心的方案,我会为你提供完整的配置步骤、代码示例和核心注意事项。 一、前置准备:安装必要依赖 首先需要安装两个核心 Python 包:selenium
阅读全文
posted @ 2025-12-28 17:16 chenlight
阅读(86)
评论(0)
推荐(0)
python:global用法体会
摘要: # 定义全局变量 # session = "初始全局值" session = None def no_global_demo(): # 未声明 global,此处是创建局部变量 session,而非修改全局变量 # session = "局部变量值" print("局部作用域内(无global):"
阅读全文
posted @ 2025-12-28 15:25 chenlight
阅读(17)
评论(0)
推荐(0)
python3网络爬虫开发实战 第2版:并发限制
摘要: import asyncio import aiohttp CONCURRENCY = 5 URL = 'https://www.baidu.com' semaphore = asyncio.Semaphore(CONCURRENCY) session = None async def scrape
阅读全文
posted @ 2025-12-28 11:52 chenlight
阅读(48)
评论(0)
推荐(0)
python,如果定义了await funa()函数,哪几种情况下可以启动函数?
摘要: 在 Python 中,如果你定义了一个 协程函数(coroutine function),例如: async def funa(): ... 那么 funa() 本身并不会立即执行,而是返回一个 协程对象(coroutine object)。要真正“启动”或“运行”这个协程函数,有以下几种常见方式:
阅读全文
posted @ 2025-12-28 10:51 chenlight
阅读(12)
评论(0)
推荐(0)
python3网络爬虫开发实战 第2版:使用aiohttp
摘要: import asyncio import aiohttp import time start = time.time() async def get(url): session = aiohttp.ClientSession() response = await session.get(url)
阅读全文
posted @ 2025-12-28 09:59 chenlight
阅读(31)
评论(0)
推荐(0)
2025年12月26日
python3网络爬虫开发实战 第二版:绑定回调
摘要: import asyncio import requests async def request(): url = 'https://www.baidu.com' status = requests.get(url) # 同步阻塞的GET请求 print("This is :",status) pr
阅读全文
posted @ 2025-12-26 17:24 chenlight
阅读(16)
评论(0)
推荐(0)
python:Ajax爬取电影详情实战
摘要: import json import requests import logging logging.basicConfig( level=logging.INFO, format='%(asctime)s - %(levelname)s: %(message)s' ) INDEX_URL = 'h
阅读全文
posted @ 2025-12-26 15:09 chenlight
阅读(16)
评论(0)
推荐(0)
2025年12月25日
python:mysql数据库
摘要: 一、创建MySql数据库 import pymysql db = pymysql.connect(host='localhost',user='root',password='root',port=3306) cursor = db.cursor() cursor.execute('SELECT V
阅读全文
posted @ 2025-12-25 22:18 chenlight
阅读(16)
评论(0)
推荐(0)
python:输出JSON
摘要: import json data = [{ 'name': 'Bob', 'gender': 'male', 'birthday': '1992-10-18' }] with open('data.json', 'w', encoding='utf-8') as file: file.write(j
阅读全文
posted @ 2025-12-25 14:52 chenlight
阅读(36)
评论(0)
推荐(0)
上一页
1
···
7
8
9
10
11
12
13
14
15
···
26
下一页
公告