Skip to content

Instantly share code, notes, and snippets.

@KushNee
Created February 2, 2015 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KushNee/6761c668f1ec745b9550 to your computer and use it in GitHub Desktop.
Save KushNee/6761c668f1ec745b9550 to your computer and use it in GitHub Desktop.
#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