10 2021 档案
摘要:Scrapy爬取色花堂磁力和图片 重点说明爬取图片 一.创建项目 scrapy startproject SeHuaTang scrapy genspider SeHuaTang "" 二.修改settings.py文件 # 控制日志输出等级 LOG_LEVEL = "WARNING" # 定义爬取
阅读全文
摘要:Themleaf结合spring boot使用 Themleaf的maven模板引擎 <!--引入thymeleaf依赖--> <dependency> <groupId>org.thymeleaf</groupId> <artifactId>thymeleaf-spring5</artifactI
阅读全文
摘要:pymongo笔记 参考文档 import pymongo # 连接mongodb myclient = pymongo.MongoClient("mongodb://localhost:27017/") # 创建数据库(没什么用,里面需要有数据才会真的创建) mydb = myclient['py
阅读全文
摘要:在pycharm中调试和运行scrapy 通常,运行scrapy爬虫的方式是在命令行输入scrapy crawl <spider_name>,调试的常用方式是在命令行输入scrapy shell <url_name>。总的来说,调试方法比较单一。其实,还有两种调试方法,可以在pycharm中实现调试
阅读全文
摘要:scrapy循环爬取色花堂标题和浏览次数 爬虫部分代码 import scrapy class ItcastSpider(scrapy.Spider): name = 'sehuatang' # 爬虫名 # allowed_domains = ['itcast.cn'] #允许爬虫的范围 start
阅读全文
摘要:scrapy基本使用 1. 安装 pip install scrapy 2. 使用 创建项目 scrapy startproject 你的项目名 创建成功后会显示创建的位置,可以用pycharm打开 打开终端,切换到项目所在目录 执行: scrapy genspider 爬虫名称 "爬虫域" 运行
阅读全文
摘要:Python之超级鹰处理验证码 登录网站为: 研究生教育信息管理系统 main里是主要内容 其他部分为超级鹰官网提供 传入用户名,密码,及软件id import requests from hashlib import md5 from selenium.webdriver import Chrom
阅读全文
摘要:处理12306登录的核心问题 主要解决问题: selenium被浏览器识别怎么办 滑动验证怎么解决 代码: from selenium.webdriver import Chrome import time from selenium.webdriver import ActionChains fr
阅读全文
摘要:两个for参数的for循环写法 if __name__ == '__main__': # zip函数 a = [1, 2, 3] b = [4, 5, 6] c = [4, 5, 6, 7, 8] p = zip(a, b) for x in p: print(x) '''结果 (1, 4) (2,
阅读全文
摘要:selenium安装 一.安装selenium 直接运行 pip install selenium (有的会显示已经安装过) 二.安装浏览器驱动 谷歌浏览器驱动: http://chromedriver.storage.googleapis.com/index.html 打开浏览器设置,查看关于ch
阅读全文
摘要:import java.util.Scanner; public class GaoSi { /** * 列主元高斯消去法 */ static double A[][]; static double b[]; static double x[]; static int n; //n表示未知数的个数
阅读全文
摘要:lxml解析数据结合Xpath import requests from lxml import etree #设置用户标识 header = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
阅读全文
摘要:Python对于文件os操作 import os # 获取当前路径 current_path = os.getcwd() print(current_path) # 创建文件夹 dir_path1=current_path+"\\wenjianjia" # 判断文件夹是否存在,不存在则创建 if o
阅读全文
摘要:bs4解析数据 #encoding=utf8 import requests import re # from lxml import etree from bs4 import BeautifulSoup #设置用户标识 header = { 'User-Agent': 'Mozilla/5.0
阅读全文
摘要:异步爬虫扒光一篇小说 # url记录 # 章节id # http://dushu.baidu.com/api/pc/getCatalog?data={book_id:4306063500} # 第一章 # http://dushu.baidu.com/api/pc/getChapterContent
阅读全文