import sys path = r'd:/Projects/洛川康复中医院/imurs/src/main/java/com/imurs/controller/ApplyBModeController.java' try: with open(path, 'r', encoding='utf-8') as f: content = f.read() # Remove spaces: { " -> {" and " } -> "} new_content = content.replace('{ "', '{"').replace('" }', '"}') with open(path, 'w', encoding='utf-8') as f: f.write(new_content) print("Successfully removed spaces from RequestMapping annotations.") except Exception as e: print(f"Error: {e}") sys.exit(1)