개발

python googletrans

내공얌냠 2022. 11. 10. 14:15

설치

!pip install googletrans==3.1.0a0

설치 시 버전을 지정해주는 이유는 References에서 볼 수도 있겠지만, 

리스트를 전달하여 번역을 할 때 2022년 11월 기준으로 버전을 지정하지 않고 설치하였을 때, 

오류가 발생하였기 때문입니다.

사용

from googletrans import Translator 

translator = Translator()           
translations = translator.translate(['The quick brown fox', '뛰다 over', 'the lazy dog'], dest='ko')
for translation in translations:
  print(translation.origin, ' -> ', translation.text)

위의 예제는 공식 홈페이지에 나와있는 내용입니다.

References

https://github.com/ssut/py-googletrans/issues/264#issuecomment-839191750

 

NoneType return on Advanced Bulk version 4.0.0-rc1 · Issue #264 · ssut/py-googletrans

Googletrans version: 4.0.0-rc1 3.x 2.x I'm submitting a ... bug report feature request Current behavior: I tried to use the bulk translate from sample code on documentation page. The translate ...

github.com

https://pypi.org/project/googletrans/

 

googletrans

Free Google Translate API for Python. Translates totally free of charge.

pypi.org

 

728x90
반응형