Created
February 2, 2015 09:23
-
-
Save KushNee/6761c668f1ec745b9550 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#encoding = utf-8 | |
import httplib2 | |
import json, sys, re | |
#from bs4 import BeautifulSoup | |
true = True | |
false = False | |
null = None | |
def query (self): | |
translateurl = 'http://openapi.baidu.com/public/2.0/bmt/translate?client_id=30jx9lLPxbMLWt2AKvz6OsSe&q=' + self + '&from=auto&to=zh' | |
get = httplib2.Http('.txt') | |
result = get.request(translateurl) | |
new_result = result[1] | |
sec_result = new_result.decode('ascii') | |
print(sec_result[:]) | |
key = input('please enter words: ') | |
query(key) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment