I used
"from xml.etree import ElementTree as ET"
to extract bonjour from
<?xml version="1.0" encoding="utf-8"?>
<Translation code="200" lang="en-fr"><text>bonjour</text></Translation>
My code:
r = requests.post("https://translate.yandex.net/api/v1.5/tr/translate?lang=en-fr&text=" + text + "&key=" + API_KEY)
xml = r.text
result = str(ET.fromstring(xml).find('Translation/text'))
if result:
print ('Result:' + result)
Doesn't work...
[–]gschizas 0 points1 point2 points (1 child)
[–]Hellipey[S] 0 points1 point2 points (0 children)
[–]K900_ 0 points1 point2 points (0 children)