Files
online_sys/frontend_财经商贸/extract_minsu_data.py
KQL a7242f0c69 Initial commit: 教务系统在线平台
- 包含4个产业方向的前端项目:智能开发、智能制造、大健康、财经商贸
- 已清理node_modules、.yoyo等大文件,项目大小从2.6GB优化至631MB
- 配置完善的.gitignore文件

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-12 18:16:55 +08:00

50 lines
1.4 KiB
Python

#!/usr/bin/env python3
import json
import re
# 读取文件
with open('src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f:
content = f.read()
# 找到民宿经营的interviews数据
start_pattern = r'"民宿经营": \['
end_pattern = r'\]\s*,\s*"文创品牌运营"'
match = re.search(f'{start_pattern}(.*?){end_pattern}', content, re.DOTALL)
if not match:
print("未找到民宿经营数据")
exit(1)
minsu_data = match.group(1)
# 提取每个岗位的数据
positions = []
pattern = r'\{\s*position:\s*"([^"]+)".*?studentInfo:\s*(\{[^}]*(?:\{[^}]*\}[^}]*)*\})'
matches = re.finditer(pattern, minsu_data, re.DOTALL)
for match in matches:
position_name = match.group(1)
student_info = match.group(2)
# 只提取前3个岗位作为示例
if len(positions) < 3:
positions.append({
'position': position_name,
'studentInfo': student_info
})
# 生成resumeTemplates格式的代码
output = ' "民宿经营": [\n'
for i, pos in enumerate(positions):
output += f' {{\n'
output += f' position: "{pos["position"]}",\n'
output += f' level: "普通岗",\n'
output += f' studentInfo: {pos["studentInfo"]}\n'
output += f' }}'
if i < len(positions) - 1:
output += ','
output += '\n'
output += ' ],\n'
print("生成的代码片段:")
print(output)