| 123456789101112131415161718 |
- import json
- with open('d:/00_26code/x11_template_vue/backend/data/templates.json', 'r', encoding='utf-8') as f:
- data = json.load(f)
- count = 0
- for item in data:
- if 'template_body' in item:
- body = item['template_body']
- if ']| first}}' in body:
- item['template_body'] = body.replace(']| first}}', ']| random}}')
- count += 1
- print(f"Modified: {item.get('id', 'unknown')}")
- with open('d:/00_26code/x11_template_vue/backend/data/templates.json', 'w', encoding='utf-8') as f:
- json.dump(data, f, ensure_ascii=False, indent=2)
- print(f'Total modified: {count}')
|