- 2010/05/28 03:31
- 131 次阅读
-
Python
核心代码
def autoSlug(str): translate_url = 'http://translate.google.com/translate_a/t?client=t&text=%s&hl=en&sl=zh-CN&tl=en&pc=0'%str.replace(' ','-').encode("utf-8") translate_result = urlfetch.fetch(translate_url,None,urlfetch.GET,HEADERS) if translate_result.status_code == 200: trans_reg = u'"trans":"([^"]*)"' translate_content = re.findall(trans_reg, translate_result.content)[0] translate_content = translate_content \ .replace(' ','-') \ .replace('\\','-') &
......
miclog
More
Recent Comments