解析脚本优化

This commit is contained in:
hahwu 2026-02-12 11:31:31 +08:00
parent 1ea61bf090
commit 71ece3ff35

View File

@ -65,7 +65,8 @@ for file_cfg in file_list:
for row in rows:
row_dict = {fieldnames[i]: row[i] for i in range(len(fieldnames))}
index = row_dict.pop(file_cfg["key"]) # 获取第一列的值作为索引并移除第一列
if index == "" or index is None:
continue # 跳过索引为空的行
# 仅保留需要的字段
fields_to_use = file_cfg.get("web_fields") if args.web and "web_fields" in file_cfg else file_cfg["fields"]
row_dict = {field: row_dict[field] for field in fields_to_use if field in row_dict}