SpringBoot 后端开发笔记
分层架构设计Controller -> Service -> Mapper -> Database 的分层结构清晰明了。 常用注解 @RestController 快速构建 RESTful API @MapperScan 自动扫描 MyBatis 接口 @Cacheable 配合 Redis 实现缓存 数据库优化 合理使用索引提升查询效率 使用连接池管理数据库连接 分页查询避免大数据量一次性加载
如何用Python写爬虫
引言爬虫是数据采集的重要工具。本文将带你用Python快速上手爬虫开发。 正文环境准备1pip install requests beautifulsoup4 发送HTTP请求123456import requestsurl = "https://example.com"response = requests.get(url)print(response.status_code)print(response.text[:500]) 解析HTML123456from bs4 import BeautifulSoupsoup = BeautifulSoup(response.text, 'html.parser')titles = soup.find_all('h1')for title in titles: print(title.get_text()) 保存数据12345678import jsondata = { 'title': '示例标题', ...