123456789 |
- import re
- case_pattern = re.compile(r"case\s(?P<name>[^:]*):\s*.*?new GUIContent\((?P<val>\"[^\"]*\")\);")
- with open("input.txt", "r", encoding="utf-8") as f:
- with open("result.txt", "w", encoding="utf-8") as fo:
- for m in case_pattern.finditer(f.read()):
- fo.write(f"[{m.group('name')}] = {m.group('val')},\n")
|