60 lines
2.0 KiB
Python
60 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
||
# -*- coding: utf-8 -*-
|
||
|
||
import json
|
||
import math
|
||
|
||
# 读取原始的个人简历内容.json
|
||
with open('/Users/apple/Documents/cursor/教务系统/frontend/网页未导入数据/个人简历内容.json', 'r', encoding='utf-8') as f:
|
||
all_data = json.load(f)
|
||
|
||
# 计算每个文件应该包含的数据量
|
||
total_items = len(all_data)
|
||
items_per_file = math.ceil(total_items / 3)
|
||
|
||
print(f"总共有 {total_items} 个岗位数据")
|
||
print(f"每个文件将包含约 {items_per_file} 个岗位")
|
||
|
||
# 拆分数据
|
||
part1 = all_data[:items_per_file]
|
||
part2 = all_data[items_per_file:items_per_file*2]
|
||
part3 = all_data[items_per_file*2:]
|
||
|
||
# 保存拆分后的文件
|
||
output_dir = '/Users/apple/Documents/cursor/教务系统/frontend/网页未导入数据/'
|
||
|
||
# 保存第一部分
|
||
with open(output_dir + '个人简历内容_part1.json', 'w', encoding='utf-8') as f:
|
||
json.dump(part1, f, ensure_ascii=False, indent=2)
|
||
print(f"Part 1: 保存了 {len(part1)} 个岗位")
|
||
|
||
# 保存第二部分
|
||
with open(output_dir + '个人简历内容_part2.json', 'w', encoding='utf-8') as f:
|
||
json.dump(part2, f, ensure_ascii=False, indent=2)
|
||
print(f"Part 2: 保存了 {len(part2)} 个岗位")
|
||
|
||
# 保存第三部分
|
||
with open(output_dir + '个人简历内容_part3.json', 'w', encoding='utf-8') as f:
|
||
json.dump(part3, f, ensure_ascii=False, indent=2)
|
||
print(f"Part 3: 保存了 {len(part3)} 个岗位")
|
||
|
||
# 输出每部分包含的岗位名称
|
||
print("\n=== Part 1 岗位列表 ===")
|
||
for item in part1:
|
||
if '❌岗位名称查询' in item:
|
||
print(f" - {item['❌岗位名称查询']}")
|
||
|
||
print("\n=== Part 2 岗位列表 ===")
|
||
for item in part2:
|
||
if '❌岗位名称查询' in item:
|
||
print(f" - {item['❌岗位名称查询']}")
|
||
|
||
print("\n=== Part 3 岗位列表 ===")
|
||
for item in part3:
|
||
if '❌岗位名称查询' in item:
|
||
print(f" - {item['❌岗位名称查询']}")
|
||
|
||
print("\n拆分完成!已生成3个文件:")
|
||
print(" - 个人简历内容_part1.json")
|
||
print(" - 个人简历内容_part2.json")
|
||
print(" - 个人简历内容_part3.json") |