From add02e5977dda1f864e9235dc0c60430c78197c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9E=97=E4=BC=9F=E6=B3=B0?=
<2509165006@student.example.com>
Date: Tue, 31 Mar 2026 11:30:12 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?=
=?UTF-8?q?=20/?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
06 林伟泰.ini | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 06 林伟泰.ini
diff --git a/06 林伟泰.ini b/06 林伟泰.ini
new file mode 100644
index 0000000..62e711f
--- /dev/null
+++ b/06 林伟泰.ini
@@ -0,0 +1,45 @@
+headers = {
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
+}
+url = 'https://movie.douban.com/top250'
+
+response = requests.get(url, headers=headers)
+html = response.text
+attern = r'([^<&]+)'
+titles = re.findall(pattern, html)
+top10 = chinese_titles[:10]
+with open('movies.txt', 'w', encoding='utf-8') as f:
+ for i, title in enumerate(top10, 1):
+ f.write(f'{i}. {title}\n')
+ # 准备:导入必要的库
+import requests
+import re
+import csv
+import json
+import time
+
+# 设置请求头,模拟浏览器访问
+headers = {
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
+}
+
+url = 'https://movie.douban.com/top250'
+
+print('开始爬取豆瓣电影Top250...')
+response = requests.get(url, headers=headers)
+print(f'状态码: {response.status_code}')
+print(f'内容长度: {len(response.text)} 字符')
+
+# 找到所有电影标题
+html = response.text
+
+# 匹配 电影名
+title_pattern = r'([^<]+)'
+titles = re.findall(title_pattern, html)
+
+# 过滤掉英文名(以/开头)
+chinese_titles = [t for t in titles if not t.startswith('/')]
+
+print('电影名称(前10部):')
+for i, title in enumerate(chinese_titles[:10], 1):
+ print(f'{i}. {title}')
\ No newline at end of file