공식 homepage : https://github.com/ssut/py-googletrans
GitHub - ssut/py-googletrans: (unofficial) Googletrans: Free and Unlimited Google translate API for Python. Translates totally f
(unofficial) Googletrans: Free and Unlimited Google translate API for Python. Translates totally free of charge. - GitHub - ssut/py-googletrans: (unofficial) Googletrans: Free and Unlimited Google ...
github.com
https://pypi.org/project/googletrans-py/
python 3.10버전 호환 : pip install git+https://github.com/StarkBotsIndustries/googletrans.git
googletrans-py
Free Google Translate API for Python. Translates totally free of charge.
pypi.org
번역 프로그램 구현
from googletrans import Translator
def translate(source_text):
translator = Translator()
src_lang = translator.detect(source_text).lang
result = translator.translate(source_text, src=src_lang, dest='ko')
print(result.text)
if __name__ == "__main__":
source = """
Regular expressions are text patterns that define the form a text string should have.
Using them, among other usages, it will be possible to do the following activities:
"""
translate(source)
구동 에러
AttributeError: 'NoneType' object has no attribute 'group'
[ 조건 ]
python version : 3.9
google trans version : 3.0
[ 해결 방법 ]
기존 버전 삭제 후 google trans version 3.1.0a0 설치
pip uninstall googletrans
pip install googletrans==3.1.0a0
'python package' 카테고리의 다른 글
Poetry를 이용한 패키지 관리 (0) | 2022.11.04 |
---|---|
openpyxl 사용법 (0) | 2022.11.02 |
gTTs 사용법 (0) | 2022.11.02 |