novel-doomsday-resurgence/debug_index_json.py
2026-04-06 22:06:30 +08:00

28 lines
855 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
import json
# 读取 index.json 文件
index_path = "books/末日重生-开局囤货十亿物资/chapters/index.json"
with open(index_path, 'r', encoding='utf-8') as f:
data = json.load(f)
print(f"数据长度: {len(data)}")
# 检查第86个元素索引85
if len(data) > 85:
item = data[85]
print(f"\n第86个元素索引85:")
print(json.dumps(item, ensure_ascii=False, indent=2))
# 检查 title 字段
if 'title' in item:
print(f"\ntitle 字段: '{item['title']}'")
print(f"title 长度: {len(item['title'])}")
print(f"title 类型: {type(item['title'])}")
else:
print("\n缺少 title 字段")
# 检查所有字段
print(f"\n所有字段: {list(item.keys())}")
else:
print(f"数据只有 {len(data)} 个元素没有第86个元素")