如何在文章中插入图片
引言在博客文章中插入图片非常简单,只需要两步:上传图片 + 引用图片。 第一步:上传图片把图片文件放到这个目录: 1source/images/posts/ 例如: source/images/posts/my-photo.jpg source/images/posts/screenshot.png source/images/posts/diagram.svg 第二步:在文章中引用使用 Markdown 图片语法: 1 示例下面是一张示例图片: 完整流程总结12345678# 1. 复制图片到博客目录copy "C:\Users\你的电脑\Desktop\照片.jpg" "C:\Users\Lenovo\Desktop\ryanwu_blog\source\images\posts\"# 2. 在文章中引用# # 3. 发布python tools/publish.py 小贴士 图片格式支持:jpg, p...
如何用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': '示例标题', ...
我的第一篇技术笔记
这是一篇技术笔记的示例文章。 代码示例12345def hello_world(): print("Hello, World!") return "success"hello_world() 后续计划后续我会在这里分享更多技术文章,包括但不限于: Python 编程技巧 前端开发经验 机器学习项目实践 算法题解