#!/usr/bin/env python3 import re # Define all the replacements to be made replacements = [ { "position": "会展讲解员", "time": "2023.09-2023.11", "company": "深圳市华奥展览服务有限公司" }, { "position": "会展执行助理", "time": "2023.09-2023.11", "company": "深圳市华奥展览服务有限公司" }, { "position": "活动执行", "time": "2024.04-2024.06", "company": "四川西行驿站文化传播有限公司" }, { "position": "活动策划师", "time": "2024.06-2024.07", "company": "浙江春风动力股份有限公司" }, { "position": "漫展策划师", "time": "2023.10-2023.12", "company": "盐城东拓国际会展服务有限公司" }, { "position": "旅游规划师", "time": "2024.05-2024.07", "company": "上海好拾光旅游咨询有限公司" }, { "position": "旅游计调专员", "time": "2024.05-2024.07", "company": "上海好拾光旅游咨询有限公司" }, { "position": "景区运营专员", "time": "2023.12-2024.02", "company": "湖北视界文旅数字科技有限公司" }, { "position": "文旅运营总监助理", "time": "2024.02-2024.03", "company": "湖北视界文旅数字科技有限公司" } ] # Read the file with open('src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f: content = f.read() # Perform replacements for each position for item in replacements: position = item["position"] time = item["time"] company = item["company"] # Create a pattern that matches the position and the placeholder time/company pattern = rf'(position: "{position}".*?### (三)实习时间:)XXXX时间(\s*\n\s*\n\s*### (四)实习单位:)某某公司' replacement = rf'\1{time}\2{company}' # Perform the replacement content = re.sub(pattern, replacement, content, flags=re.DOTALL) print(f"Updated {position}: {time} at {company}") # Write the updated content back with open('src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f: f.write(content) print("\n✅ All resume internship data has been updated successfully!")