1
2
3
4
5
6
7
8
9
10
11
12
13
from langdetect import detect

text = "你好,世界"
#text = "坐禅はツール"
text = "[のか](part0018.html#_idParaDest-31):身体感觉是真实的吗"
language = detect(text)

if language == 'zh-cn':
print("这是中文文本")
elif language == 'ja':
print("这是日文文本")
else:
print("这不是中文或日文", language)