import re file_path = 'server/src/app/services/user_agent_response.py' with open(file_path, 'r', encoding='utf-8') as f: content = f.read() content = re.sub( r'\s*"fallback_answer": fallback_answer,', '', content ) with open(file_path, 'w', encoding='utf-8') as f: f.write(content) print('Done.')