Files
my-webtoon/compare_bomtoon_count.py
2025-05-11 18:58:43 +02:00

34 lines
859 B
Python

from pathlib import Path
BOMTOON = "Unsleep"
PATH = Path('E:/') / 'Webtoon' / BOMTOON
folders = [
(int(p.name.split('.')[0]), p) # 取前缀数字用于排序
for p in PATH.iterdir()
if p.is_dir() and p.name.split('.')[0].isdigit()
]
folders.sort(key=lambda x: x[0])
webp_counts = []
for index, path in folders:
count = len([f for f in path.iterdir() if f.is_file() and f.suffix.lower() == ".webp"])
webp_counts.append(count)
# 输出最终结果
print(webp_counts)
txt = PATH / "div_counts.txt"
with txt.open("r") as f:
counts = [int(line.strip()) for line in f if line.strip()]
print(counts)
for i, (a, b) in enumerate(zip(counts, webp_counts)):
if a != b + 1:
print(f"❌ 第 {i} 项不同: list1 = {a}, list2 + 1 = {b + 1}")
else:
print(f"✅ 第 {i} 项相同: list1 = {a}, list2 + 1 = {b + 1}")