We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2657403 commit f95bfbbCopy full SHA for f95bfbb
terminal-dictionary/terminal-dictionary.py
@@ -0,0 +1,19 @@
1
+import urllib
2
+import json
3
+
4
+title = raw_input("Enter word to search: ")
5
+print "Word: ",title
6
7
+#stores the json formatted output to a variable
8
+url = 'http://glosbe.com/gapi/translate?from=eng&dest=eng&\
9
+format=json&phrase='+title+'&pretty=true'
10
11
+#json representation of url is stored in variable result
12
+result = json.load(urllib.urlopen(url))
13
14
+#get the first text in "meaning" in "tuc" from result
15
+try:
16
+ print "Meaning: ", result["tuc"][0]["meanings"][0]["text"]
17
+except Exception as e:
18
+ print "Error!"
19
0 commit comments