微信关注,获取更多

火鸟的文章

原创资料

跟着AI学Python 第15课:爬虫基础

# === 第15课:爬虫基础 === import requests from bs4 import BeautifulSoup # 1. 获取网页内容 print("--- 第1段:获取网页 ---") url = "https://books.toscrape.com/" # 专门给爬虫练习的网站 response = requests.get(url...
赞 (0)阅读(630)评论(0)
原创资料

跟着AI学Python 第16课:爬虫进阶!

# === 第16课:爬虫进阶 === import requests from bs4 import BeautifulSoup import json import time # 1. 翻页抓取:分析URL规律 print("--- 第1段:翻页规律 ---") # books.toscrape.com 第1页: # https://books.tosc...
赞 (0)阅读(641)评论(0)
原创资料

跟着AI学Python 速查表

# 条件判断 if 条件: ... elif 条件: ... else: ... # 循环 for 变量 in 列表: ... while 条件: ... # 函数 def 函数名(参数): return 结果 # 字典 d = {"键": "值"} d["键"] # 取值 d["新键"] = 值 # 添加 # 文件读写 with open("文件", "r...
赞 (0)阅读(677)评论(0)
原创资料

跟着AI学Python 综合实战

# === 第10课:综合实战 - 完整版通讯录系统 === import os import json # 文件路径 DIR = os.path.dirname(os.path.abspath(__file__)) DATA_FILE = os.path.join(DIR, "contacts.json") # 1. 联系人类(第9课:面向对象) clas...
赞 (0)阅读(719)评论(0)