# -*- coding:utf-8 -*-
import urllib2
import lxml.html as HTML def get_wordmean():
url = 'http://www.iciba.com/'
search = raw_input('search:')
url += search
headers = {'User-Agent':'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'}
req = urllib2.Request(url, headers=headers)
content = urllib2.urlopen(req).read()
if isinstance(content, unicode):
pass
else:
content = content.decode('utf-8')
htmlSource = HTML.fromstring(content)
prop = htmlSource.xpath(r"//span[@class='prop']/text()|//li[@class='clearfix']/p/span/text()")
if prop:
for i in prop:
print i
else:
print 'please input correct word!' if __name__ == "__main__":
get_wordmean()

最新文章

  1. shell 脚本之 shell 练习题汇总
  2. Linux下配置Node.js环境
  3. JVM内存模型和性能优化 转
  4. UNIX网络编程——getsockname和getpeername函数
  5. lucene/solr 修改评分规则方法总结
  6. C# 控制台程序如何能不显示窗口
  7. Delphi XE5 android listview
  8. Windows下安装Eric5时出现的“Sorry, please install QtHelp.”问题解决办法
  9. Eclipse相关集锦第二季
  10. PoolBoy
  11. PyCharm 教程
  12. Swift 3.0在集合类数据结构上的一些新变化
  13. 【Android 应用开发】GitHub 优秀的 Android 开源项目
  14. YII框架CGridView分页实现
  15. css响应式
  16. JAVA中通过Jedis操作Redis连接与插入简单库
  17. 洛谷P1638逛画展
  18. AndroidのInputFillter之按字符过滤长度,一个中文当两个字符
  19. IO库----IO类,文件输入输出,string流
  20. English trip -- VC(情景课)5 D

热门文章

  1. Excel2010如何实现隔行设置背景色
  2. Murano Weekly Meeting 2015.07.14
  3. 利用Python进行数据分析 2017 第二版 项目代码
  4. 7天学完Java基础之0/7
  5. html5的使用
  6. BZOJ4355: Play with sequence(吉司机线段树)
  7. 《C++面向对象程序设计》之变量的生存期
  8. Spring Boot概要
  9. leetcode 355 Design Twitte
  10. newCoder在线编程---(1)