0
나는 this question에서 얻은 다음 코드를 사용하여 러시아어 이름에서 국가 코드를 얻습니다.jupyter-notebook/python 대화식 모드에서 gettext를 사용하려면 어떻게해야합니까?
def get_country_code(russian_name):
gettext.translation('iso3166', pycountry.LOCALES_DIR, languages=['RU']).install()
country_code = ''.join([country.alpha_2 for country in pycountry.countries if _(country.name) == russian_name])
return country_code
하지만 내 jupyter 노트북에서이 기능을 사용하려고, 그것은 나에게 다음과 같은 오류를 제공합니다 :
입니다이처럼 보인다TypeError: 'str' object is not callable
이 때문에 jupyter뿐만 아니라 대화 형 모드에서 _ 이전 계산의 결과를 의미하지만 gettext는이를 함수로 정의합니다.
어떻게이 코드를 Jupyter에서 실행할 수 있습니까?