摘要: from urllib.request import Request, ProxyHandler from urllib.request import build_opener from bs4 import BeautifulSoup import redis urlfront = "http://www.xicidaili.com" url = "http://www.xicidaili.c... 阅读全文
posted @ 2017-11-16 19:53 窃语 阅读(137) 评论(0) 推荐(0)
摘要: 内存数据库: 1.双击redis-server.exe =>启动2.双击redis-cli.exe =>打开管理控制台3.查看所有key keys *4.查看key类型 type myKey 操作:1.字符串类型: 创建和修改: set user 'zhangsan' 获得key的值 get use 阅读全文
posted @ 2017-11-15 21:24 窃语 阅读(122) 评论(0) 推荐(0)
摘要: # 爬豆瓣需要用cookie# 需要注意隐藏的参数,即input 里面的默认的一些参数# 需要自己注册一个账户密码import urllib.requestimport http.cookiejarfrom lxml import etreeimport spiderimagehead= { 'Co 阅读全文
posted @ 2017-11-13 21:47 窃语 阅读(358) 评论(0) 推荐(0)
摘要: import urllib.request import http.cookiejar from lxml import etree head = { 'Connection': 'Keep-Alive', 'Accept': 'text/html, application/xhtml+xml, */*', 'Accept-Language': 'en-US,en;q=0... 阅读全文
posted @ 2017-11-11 10:50 窃语 阅读(165) 评论(0) 推荐(0)
摘要: #通过登录去爬虫 #首先要有用户名和密码 import urllib.request import http.cookiejar from lxml import etree head = { 'Connection': 'Keep-Alive', 'Accept': 'text/html, application/xhtml+xml, */*', 'Accept-Lan... 阅读全文
posted @ 2017-11-11 10:48 窃语 阅读(2449) 评论(0) 推荐(1)
摘要: 1.前台<form method="post" action="./writerApply" enctype="multipart/form-data"> <br> <input type="text" name="realname" placeholder="真实姓名" class=" rowsp 阅读全文
posted @ 2017-11-10 22:24 窃语 阅读(738) 评论(0) 推荐(0)
摘要: python是如何进行内存管理的? 3个方面:1.垃圾回收:当引用计数为0时,或两个变量相互引用,但其本身为已经为0(独立的引用环)2.引用计数:一个对象被创建时,就会创建一个引用计数。对象不再需要,且引用计数为0才会被垃圾回收3.内存池机制:每个对象都有独立的内存池,且对象之间的内存池不相互引用, 阅读全文
posted @ 2017-11-08 19:24 窃语 阅读(326) 评论(0) 推荐(0)
摘要: 代理的IP通过去网上找# -*- coding: utf-8 -*- import re import _thread from time import sleep, ctime from urllib.request import urlopen from urllib.request import Request from urllib.request import ProxyHandler... 阅读全文
posted @ 2017-11-07 20:33 窃语 阅读(152) 评论(0) 推荐(0)
摘要: 通过lxml的方式去分析数据,将爬到的数据放到file中的html中代码如下# 用线程去爬虫 from urllib.request import Request from urllib.request import urlopen from time import sleep,ctime from lxml import etree import _thread; ii=0 headers =... 阅读全文
posted @ 2017-11-07 20:29 窃语 阅读(168) 评论(0) 推荐(0)
摘要: 透明代理的意思是客户端根本不需要知道有代理服务器的存在,但是它传送的仍然是真实的IP。你要想隐藏的话,不要用这个。 普通匿名代理能隐藏客户机的真实IP,但会改变我们的请求信息,服务器端有可能会认为我们使用了代理。不过使用此种代理时,虽然被访问的网站不能知道你的ip地址,但仍然可以知道你在使用代理,当 阅读全文
posted @ 2017-11-07 20:19 窃语 阅读(624) 评论(0) 推荐(0)