我们在写css时,标签名不加任何修饰,类名前加 '.',id前加#,在这里我们也可以用类似的方法来筛选元素 用到的方法是soup.select(),返回类型list (1)通过标签名查找 (2)通过类名查找 (3)通过id名查找 (4)组合查找 组合查找即和写 class 文件时,标签名与类名、id ...
分类:
Web程序 时间:
2017-04-09 17:00:03
阅读次数:
216
FAQ记录 1. 错误源码 错误源码如下 def fillUnivList(_html,_ulist): soup =BeautifulSoup(_html,'html.parser') for tr in soup.find_all('tbody').children: if isinstance ...
分类:
编程语言 时间:
2017-04-08 00:44:17
阅读次数:
311
ADAFIELD - Ada and Field #binary-search #datastructures #binary-search #datastructures Ada the Ladybug owns a beautiful field where she grows vegetabl ...
分类:
其他好文 时间:
2017-04-07 00:42:49
阅读次数:
156
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4888 题意:给一个矩阵没行的和和每列的和,问能否还原矩阵,如果可以还原解是否唯一,若唯一输出该矩阵。 思路:设一个源点和汇点,每行的和和源点加边,权值为该行的和,每列的和和汇点加点,权值为该列的和。 每 ...
1. 环境 - Python mac os预装的python - IDE Pycharm - 辅助 安装pip - Python库 2. 问题 - 问题1 代码: soup = BeautifulSoup(html, 'lxml') 报错: Traceback (most recent call l ...
分类:
编程语言 时间:
2017-04-04 17:38:53
阅读次数:
342
re.findall soup.find_all Q for i in ***: ***可以是什么类型,主要是关心什么类型的不可以 trackback用法 >>> >>> import traceback>>> try:... 1/0... except (Exception,e):... trac ...
分类:
编程语言 时间:
2017-04-04 09:38:38
阅读次数:
460
#爬取当当网图书,未使用框架 #main是主函数 #KindLinks.py和 获取数据信息.py 是2个封装的类 #KindLinks只有一个方法,它返回的是 listUrl (name(小分类名称),url(小分类对应的链接)) LB (总的分类) #获取数据信息有2个方法, getpage() ...
分类:
其他好文 时间:
2017-04-02 17:33:52
阅读次数:
221
写爬虫的时候遇到的: 导入beautifulSoup后, 查找类似<div class = "abcd">的时候, 直接使用beautifulsoup的方法: soup.findall("div", class="abcd") 这样写的时候回报错, 按照官方的一种方法写在class后加“_“试了试没 ...
分类:
其他好文 时间:
2017-04-01 12:52:14
阅读次数:
498
using System; using System.Collections.Generic; using System.Linq; using System.Web; public class ComBase { public string result { get; set; } public ...
本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作。 本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作。 本文作者:ljh2000 作者博客:http://www.cnblogs.com/ljh2000-jump/转载请注 ...
分类:
其他好文 时间:
2017-03-27 21:06:49
阅读次数:
137