随笔分类 - beautifulSoup
摘要:暂且不说,彩票预测是否靠谱?彩票预测也分人而异,江湖上骗术很多,有些甚至会误以为彩票预测的准确度可以很高,这些操盘手法,让不知原理的彩民心甘情愿地掏钱买料。 在彩票预测上,也有正儿八经去研究“规律” 的。不外乎三个“派别”:数据派、图形派、公式派。还有一派不列入:字谜字画派,可纳入蛇精病行列。 究竟
阅读全文
摘要:例子: soup=BeautifulSoup(r.text,"html.parser") print soup.div.find('div',id="site_nav_top").text print soup.div.find('div',id="site_nav_top").string 用py
阅读全文
摘要:1、网页输出乱码的解决办法 r= requests.get('https://www.baidu.com/') r.encoding = 'gbk2312' #有可能 gbk、utf-8 soup=BeautifulSoup(r.text,"html.parser") 来源:https://blog
阅读全文
摘要:html页面如下 <tr style="background-color:#fff;"> <td colspan="2" align=left valign="top"> <table id="zoom2" width="94%" border="0" cellspacing="0" cellpad
阅读全文
摘要:获取,标签里面属性的值的方法,(下面是获取a标签里面属性source-data-lazy-img的值 ) soup2 = BeautifulSoup(span.encode('utf-8'), 'html.parser')for img2 in soup2.find_all('img',{"sour
阅读全文
摘要:第一步 #src链接要符合下面要求,这里返回是 false or true def valid_img(src): return src.endswith('jpg') and 'img.jandan.net' in src 第二步 然后可以把上面的方法,套到find_all 里面用 #获取属性sr
阅读全文
摘要:# coding=utf-8import requestsfrom bs4 import BeautifulSoup headers = { 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.
阅读全文
摘要:soup = BeautifulSoup(requests.get(url).text, 'html.parser') soup.find('span', class_='item_hot_topic_title') 这个是只能找到第一个span标签 样式为 class='item_hot_topi
阅读全文
摘要:案例一: #coding=utf-8import jsonimport requestsfrom bs4 import BeautifulSoupurl = 'http://www.itest.info/courses' # 定义被抓取页面的urlsoup = BeautifulSoup(reque
阅读全文