# 替换字符串 turkey_replace_dict = { 'ç': 'c', 'Ç': 'C', 'ğ': 'g', 'Ğ': 'G', 'ı': 'i', 'İ': 'I', 'ö': 'o', 'Ö': 'O', 'ş': 's', 'Ş': 'S', 'ü': 'u', 'Ü': 'U' } turkey_to_english_trans = str.maketrans(turkey_replace_dict) def replace_str_english(text: str, country_name: str) -> str or None: if text: if country_name == 'turkey': return text.translate(turkey_to_english_trans) return None if __name__ == '__main__': text = 'SÖZAL KİMYA SANAYİ VE TİCARET ANONİM ŞİRKETİ' english_text = replace_str_english(text, 'turkey') print(english_text)