![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
名字1001
这个作者很懒,什么都没留下…
展开
-
Scrapy
pip install Scrapyscrapy.cfgmyproject/ __init__.py items.py middlewares.py pipelines.py settings.py spiders/ __init__.py spider1.py spider2.py ...原创 2019-10-01 23:38:41 · 138 阅读 · 0 评论 -
OCR百度api,python实现图像文字识别
from urllib.request import Request,urlopen# client_id 为官网获取的AK, client_secret 为官网获取的SKurl = 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=【API Key】&clien...原创 2019-10-06 00:40:26 · 1608 阅读 · 1 评论 -
python使用正则
import reimport requestsfrom fake_useragent import UserAgenturl = 'https://www.baidu.com'm = re.match(r'\w+',url)print(m.group())url2 = 'http://www.97xs.org/11/11389/3303898.html'headers = {...原创 2019-10-05 10:35:32 · 221 阅读 · 0 评论 -
python冒泡排序
data=[16,25,39,27,12,8,45,66]foriinrange(7,-1,-1):forjinrange(i):ifdata[j]>data[j+1]:data[j],data[j+1]=data[j+1],data[j]print('次数...原创 2019-10-04 20:09:49 · 149 阅读 · 0 评论 -
爬虫proxy代理,简单实例
from urllib.request import Request,build_openerfrom fake_useragent import UserAgentfrom urllib.request import ProxyHandlerurl = 'https://www.qidian.com'headers = { "User-Agent":"Mozilla/5.0...原创 2019-10-04 19:59:30 · 1664 阅读 · 0 评论 -
python爬虫,使用cookie实例
from urllib.request import Request,build_opener,HTTPCookieProcessorfrom urllib.parse import urlencodefrom fake_useragent import UserAgentfrom http.cookiejar import MozillaCookieJardef get_cookie...原创 2019-10-04 19:56:45 · 345 阅读 · 0 评论 -
爬虫,使用请求头User-Agent
from urllib.request import urlopenfrom urllib.request import Requesturl = 'https://www.hao123.com'header = { 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like ...原创 2019-10-03 22:02:03 · 522 阅读 · 0 评论 -
爬虫,get请求,添加参数
arg = '编程语言'url = 'https://www.baidu.com/s?wd={}'.format(quote(arg))#url = 'https://www.baidu.com/s?wd=python'headers = { "User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.3...原创 2019-10-03 22:00:41 · 664 阅读 · 1 评论 -
爬虫,post请求
from urllib.request import Request,urlopenfrom urllib.parse import urlencodeurl = 'https://www.zhihu.com/signin?next=%2F'args = { 'username':'16633970705', 'password':'16633970705'}f_dat...原创 2019-10-03 21:59:40 · 208 阅读 · 0 评论 -
爬虫,多个页面
from urllib.request import Request,urlopenfor i in range(3): url = 'http://hao123.zongheng.com/store/c0/w0/s0/p{0}/all.html'.format(i+1) r = Request(url) html = urlopen(r).read().decode...原创 2019-10-03 21:58:44 · 532 阅读 · 0 评论 -
爬虫忽略ssl证书
from urllib.request import Request,urlopenimport sslurl = 'https://www.hao123.com'r = Request(url)#忽略证书context = ssl._create_unverified_context()response = urlopen(r,context=context)print(re...原创 2019-10-03 21:57:42 · 518 阅读 · 0 评论 -
学习scrapy,起点小说简易爬虫
# -*- coding: utf-8 -*-import scrapyclass QidianSpider(scrapy.Spider): name = 'qidian' allowed_domains = ['qidian.com'] start_urls = ['https://read.qidian.com/chapter/ZOJ_pWRoTg9wKI0S...原创 2019-10-03 14:50:50 · 999 阅读 · 2 评论 -
django学习views视图
from django.shortcuts import renderfrom django.http import HttpRequestdef about(request): assert isinstance(request, HttpRequest) return render( request, 'app/about.htm...原创 2019-10-07 20:19:07 · 152 阅读 · 0 评论