I'm using the langdetect and it should return the probability/percentage of a certain language in a string which is something like [en:0.9999960343803843] for an English text. I want to check the language and the percentage and store them in variables to use them later but I can't do anything with it except printing it. the type seems to be <class 'langdetect.language.Language'>
lan="Otec matka syn."
lan=detect_langs(line)
print(lan)
print(type(lan[0]))
this code outputs
[pl:0.7142846922445223, fi:0.2857135474194883]
<class 'langdetect.language.Language'>
note: It's not json because i've tried json.loads(lan[0]) and an error says it should be a string not language
edit: as user696969 answered the solution was to save them in a dict
x=detect_langs(line)
lan={}
for lang in x:
lan.update({lang.lang: lang.prob})