This article example describes how Python implements the English-Chinese dictionary function based on Yudao. Shared for your reference. Specific as follows:
import re,urllib aa="/search?tab=chn&keyfrom=&q=" print ("input q! to exit ") while 1: word=raw_input(">>>") if word=="q!": exit() else: word=(' ','+') url=aa+word s=(url).read() comm=(r'<td class="dttitle2"><font color="#013694"><b>(.*?)<\/b><\/font><\/td>') tem=(s) com=('<td class="attributem1web">(.*?)</td>',||) result=(s) if tem: for i in tem: temp=('utf8').encode('cp936') print (temp) print '\n' else: print ("no such word\n")
I hope that what I have described in this article will help you in your Python programming.