Skip to content

Instantly share code, notes, and snippets.

Created Apr 22, 2017
What would you like to do?
translate between tatar and russian from CLI
#!/usr/bin/env python3
import sys
from urllib.parse import quote
from lxml import html
if len(sys.argv) > 1:
word = sys.argv[1]
url = "" + quote(word)
results = html.parse(url).getroot().cssselect(".search_results")
if results:
translation = results[0].text_content()
print("could not translate", word)
print("please specify your word")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment