引入库函数
pip install langdetect
from langdetect import detect
text1 = "Hello, world!"
language1 = detect(text1)
print(f"The language of the text is: {language1}")
# 例二
text2 = "你好,世界!"
language2 = detect(text2)
print(f"The language of the text is: {language2}")