上一页 1 ··· 5 6 7 8 9 10 11 12 13 下一页

2019年11月4日

PYTHON装饰器

摘要: def zhuangshi(func): def hello1(*args,**kwargs): print(kwargs) func(*args,**kwargs) return hello1 @zhuangshi def hello(name,*args,**kwargs): print('he 阅读全文

posted @ 2019-11-04 10:31 土豆爸 阅读(117) 评论(0) 推荐(0)

2019年10月30日

scrapy

摘要: __author__ = 'Administrator' # -*- encoding:utf-8 -*- import scrapy class QuoteSpider(scrapy.Spider): name = 'poxiao' start_urls=['https://www.poxiao. 阅读全文

posted @ 2019-10-30 16:10 土豆爸 阅读(298) 评论(0) 推荐(0)

xpath

摘要: XPath,全称XML Path Language,即XML路径语言,它是一门在XML文档中查找信息的语言。它最初是用来搜寻XML文档的,但是它同样适用于HTML文档的搜索。 所以在做爬虫时,我们完全可以使用XPath来做相应的信息抽取。本节中,我们就来介绍XPath的基本用法。 1. XPath概 阅读全文

posted @ 2019-10-30 15:52 土豆爸 阅读(314) 评论(0) 推荐(0)

2019年10月21日

python 多线程

摘要: 过程的名字可以随便,但是在下面的类里面就必须用RUN 这就是多线程的两种写法。 算程序运行的时间 应该用 守护线程的意义 正常来讲,这个num结果应该是0, 但在python 2.7上多运行几次,会发现,最后打印出来的num结果不总是0,为什么每次运行的结果不一样呢? 哈,很简单,假设你有A,B两个 阅读全文

posted @ 2019-10-21 14:29 土豆爸 阅读(155) 评论(0) 推荐(0)

2019年10月20日

xpath helper 表格爬取

摘要: //table[@width="717"]//tr[position()>1]/td[2] 阅读全文

posted @ 2019-10-20 22:01 土豆爸 阅读(416) 评论(0) 推荐(0)

2019年10月19日

爬取xiachufang图片试手

摘要: __author__ = 'Administrator' # -*- encoding=gbk -*- import requests import os from bs4 import BeautifulSoup from urllib.parse import urlparse r=requests.get('http://xiachufang.com/') soup=BeautifulS... 阅读全文

posted @ 2019-10-19 22:33 土豆爸 阅读(132) 评论(0) 推荐(0)

2019年10月17日

bs4 beautifullsoup网页内容选择器

摘要: # -*- encoding:utf-8 -*- import requests from bs4 import BeautifulSoup r=requests.get('http://cnblogs.com/xupanfeng') r.encoding='utf-8' import io import sys import urllib.request sys.stdout = io.Text 阅读全文

posted @ 2019-10-17 10:31 土豆爸 阅读(342) 评论(0) 推荐(0)

2019年10月16日

requests第三方库使用 抓取

摘要: import requests r=requests.get('http://httpbin.org/get') r.text#内容 r.json()#直接变成json格式 r.status_code#200 r.reason#ok r=requests.post('http://httpbin.org/post',{'a':'1'});print(r.json())#post参数传递 r=req 阅读全文

posted @ 2019-10-16 14:08 土豆爸 阅读(197) 评论(0) 推荐(0)

2019年10月11日

python 爬虫学习

摘要: 看USERAGENT urllib库 2.REQUEST库 阅读全文

posted @ 2019-10-11 23:32 土豆爸 阅读(144) 评论(0) 推荐(0)

2019年10月10日

解决PRINT函数UTF-8问题

摘要: https://blog.csdn.net/jim7424994/article/details/22675759 Python3.6(windows系统)解决编码问题 Python3.6(windows系统)解决编码问题 1,py文件代码: import urllib.request url = 阅读全文

posted @ 2019-10-10 08:39 土豆爸 阅读(1664) 评论(0) 推荐(0)

上一页 1 ··· 5 6 7 8 9 10 11 12 13 下一页

导航