国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

Python基于有道實現(xiàn)英漢字典功能

2019-11-25 17:07:48
字體:
供稿:網(wǎng)友

本文實例講述了Python基于有道實現(xiàn)英漢字典功能的方法。分享給大家供大家參考。具體如下:

import re,urllibaa="http://dict.youdao.com/search?tab=chn&keyfrom=dict.top&q="print ("input q! to exit ")while 1:  word=raw_input(">>>")  if word=="q!":    exit()  else:    word=word.replace(' ','+')    url=aa+word    s=urllib.urlopen(url).read()    comm=re.compile(r'<td class="dttitle2"><font color="#013694"><b>(.*?)<//b><//font><//td>')    tem=comm.findall(s)    com=re.compile('<td class="attributem1web">(.*?)</td>',re.S|re.M|re.I)    result=com.findall(s)  if tem:    for i in tem:      temp=i.decode('utf8').encode('cp936')      print (temp)      print '/n'  else:    print ("no such word/n")

希望本文所述對大家的Python程序設(shè)計有所幫助。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 炎陵县| 瑞昌市| 和田县| 荔浦县| 蒲城县| 石泉县| 昌宁县| 新营市| 莱芜市| 乌拉特中旗| 临城县| 潮州市| 湖北省| 黄石市| 靖边县| 句容市| 博湖县| 辉南县| 克山县| 彭州市| 买车| 多伦县| 紫阳县| 张北县| 偏关县| 绩溪县| 池州市| 清流县| 金湖县| 杭锦后旗| 阳高县| 双辽市| 同仁县| 泗阳县| 澄江县| 广宗县| 通河县| 淮安市| 奈曼旗| 望都县| 华亭县|