08 2020 档案

摘要:import time #from os import system import os runing = True while runing: inputs =input('关机(s),重启(r)') inputs = inputs.lower() if inputs == 's': print( 阅读全文
posted @ 2020-08-31 20:15 kuanleung 阅读(5) 评论(0) 推荐(0) 编辑
摘要:网易: http://mirrors.163.com/ubuntu-releases/ 首都在线科技股份有限公司: http://mirrors.yun-idc.com/ubuntu-releases/ 阿里云: http://mirrors.aliyun.com/ubuntu-releases/ 阅读全文
posted @ 2020-08-28 11:29 kuanleung 阅读(3) 评论(0) 推荐(0) 编辑
摘要:在打开电脑,会出现选择系统。第1个位置是Ubuntu,第5个是windows系统,ubuntu16版本设置在/boot/grub/grub.cfg文件的 set default = '0' ,修改为 set default = '4' 如果无法改动,需要设置写入权限,在终端执行 sudo chmod 阅读全文
posted @ 2020-08-28 11:22 kuanleung 阅读(4) 评论(0) 推荐(0) 编辑
摘要:合并与分割 功能代码函数合并之拼接tf.concat(tensors,axis)合并之堆叠tf.stack(tensors, axis)分割tf.split(x,num_or_size_split,axis)分割tf.unstack(x,axis) 合并 拼接 tf.concat(tensors,a 阅读全文
posted @ 2020-08-25 08:58 kuanleung 阅读(19) 评论(0) 推荐(0) 编辑
摘要:数学运算 功能代码函数加tf.add减tf.subtract乘tf.multiply除tf.divide整除//余除%乘方**或者 tf.pow(x, a)矩阵乘法@平方和tf.square(x)平方根tf.sqrt(x)自然指数etf.exp(x)自然对数tf.math.log() 简单运算 im 阅读全文
posted @ 2020-08-23 10:49 kuanleung 阅读(6) 评论(0) 推荐(0) 编辑
摘要:张量的变换 功能代码改变视图tf.reshape(x,shape)增加维度tf.expand_dims(x, axis)删除维度tf.squeeze(x, axis)交换维度tf.transpose(x, perm)复制数据tf.tile(x, multiples) 改变视图 tf.reshape( 阅读全文
posted @ 2020-08-22 18:47 kuanleung 阅读(14) 评论(0) 推荐(0) 编辑
摘要:数据索引与切片 索引 通过随机数模拟输入x为 5张6 × 6大小的彩色图片, 张量表达为x[5,6,6,3]x[k][m][n][h] 与 x[k,m,n,h]表达方式等价 import tensorflow as tf x = tf.random.normal([5,6,6,3]) print(x 阅读全文
posted @ 2020-08-22 15:05 kuanleung 阅读(3) 评论(0) 推荐(0) 编辑
摘要:张量的应用 标量 简单 向量 用于b向量的构建 矩阵 多个样本的计算 矩阵运算例子: import tensorflow as tf x = tf.random.normal([3,4]) #模拟3个样本4个特征的输入数据 w = tf.ones([4,3]) #权重 b = tf.zeros([3 阅读全文
posted @ 2020-08-22 14:38 kuanleung 阅读(8) 评论(0) 推荐(0) 编辑
摘要:创建张量 综述: 功能代码利用数组、列表对象创建张量tf.constant与tf.convert_to_tensor创建纯0 或纯 1 张量tf.zeros()和tf.ones()按照现有张量创建纯0 或纯 1 张量tf.zeros_like, tf.ones_like创建自定义纯数字张量tf.fi 阅读全文
posted @ 2020-08-21 15:13 kuanleung 阅读(13) 评论(0) 推荐(0) 编辑
摘要:数据类型 tensorflow的基础是数据类型,依赖特有的函数进行创建,此部分介绍与演示创建最基础常用的数据类型 数值类型、 字符串类型和布尔类型 数值类型 标量 0,1,2,3,4,5 创建标量实例: import tensorflow as tf a = tf.constant(1.2) b = 阅读全文
posted @ 2020-08-21 13:54 kuanleung 阅读(13) 评论(0) 推荐(0) 编辑
摘要:安装Tensorflow 自动安装: pip install tensorflow -i https://pypi.douban.com/simple 速度最快的镜像 https://pypi.tuna.tsinghua.edu.cn/simple 镜像站点汇总 https://blog.csdn. 阅读全文
posted @ 2020-08-20 18:19 kuanleung 阅读(4) 评论(0) 推荐(0) 编辑
摘要:tensorflow镜像地址: https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/tensorflow/ 点击进入 tensorflow镜像站点 阅读全文
posted @ 2020-08-20 17:40 kuanleung 阅读(1) 评论(0) 推荐(0) 编辑
摘要:一、站点 (一)企业站 网易:http://mirrors.163.com/搜狐:http://mirrors.sohu.com/(Ubuntu旧发行版同步被冻结,不同步Ubuntu新发行版,Ubuntu源同步正常)阿里云:http://mirrors.aliyun.com/(部分镜像同步延迟超过1 阅读全文
posted @ 2020-08-20 11:08 kuanleung 阅读(3) 评论(0) 推荐(0) 编辑
摘要:基础 结语 爬虫基础部分资料更新与学习已经完成,有疑问的小伙伴可以留言或私聊我,下一步计划是学习与更新tensorflow的相关知识 阅读全文
posted @ 2020-08-20 10:48 kuanleung 阅读(4) 评论(0) 推荐(0) 编辑
摘要:import scrapy class LogSpider(scrapy.Spider): name = 'log' allowed_domains = ['sxt.cn'] # start_urls = ['http://sxt.cn/'] def start_requests(self): ur 阅读全文
posted @ 2020-08-15 11:24 kuanleung 阅读(7) 评论(0) 推荐(0) 编辑
摘要:http_ua.py import scrapy class HttpUaSpider(scrapy.Spider): name = 'http_ua' allowed_domains = ['http://httpbin.org/get'] start_urls = ['http://httpbi 阅读全文
posted @ 2020-08-11 14:09 kuanleung 阅读(7) 评论(0) 推荐(0) 编辑
摘要:scrapy genspider -t crawl zwr zedu.com import scrapy from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Rule clas 阅读全文
posted @ 2020-08-11 11:22 kuanleung 阅读(4) 评论(0) 推荐(0) 编辑
摘要:1. Scrapy-Request和Response(请求和响应) Scrapy的Request和Response对象用于爬网网站。 通常,Request对象在爬虫程序中生成并传递到系统,直到它们到达下载程序,后者执行请求并返回一个Response对象,该对象返回到发出请求的爬虫程序。 sequen 阅读全文
posted @ 2020-08-10 15:51 kuanleung 阅读(5) 评论(0) 推荐(0) 编辑
摘要:1. Spider 下载中间件(Middleware) Spider 中间件(Middleware) 下载器中间件是介入到 Scrapy 的 spider 处理机制的钩子框架,您可以添加代码来处理发送给 Spiders 的 response 及 spider 产生的 item 和 request 2 阅读全文
posted @ 2020-08-10 15:51 kuanleung 阅读(12) 评论(0) 推荐(0) 编辑
摘要:1. 介绍 Scrapy提供了一个 item pipeline ,来下载属于某个特定项目的图片,比如,当你抓取产品时,也想把它们的图片下载到本地。 这条管道,被称作图片管道,在 ImagesPipeline 类中实现,提供了一个方便并具有额外特性的方法,来下载并本地存储图片: 将所有下载的图片转换成 阅读全文
posted @ 2020-08-10 15:51 kuanleung 阅读(3) 评论(0) 推荐(0) 编辑
摘要:1. CrawlSpiders 原理图 sequenceDiagram start_urls ->>调度器: 初始化url 调度器->>下载器: request 下载器->>rules: response rules->>数据提取: response rules->>调度器: 新的url 通过下面的 阅读全文
posted @ 2020-08-10 15:50 kuanleung 阅读(7) 评论(0) 推荐(0) 编辑
摘要:爬取小说 spider import scrapy from xiaoshuo.items import XiaoshuoItem class XiaoshuoSpiderSpider(scrapy.Spider): name = 'xiaoshuo_spider' allowed_domains 阅读全文
posted @ 2020-08-10 15:50 kuanleung 阅读(8) 评论(0) 推荐(0) 编辑
摘要:Scrapy内置设置 下面给出scrapy提供的常用内置设置列表,你可以在settings.py文件里面修改这些设置,以应用或者禁用这些设置项 BOT_NAME 默认: ‘scrapybot’ Scrapy项目实现的bot的名字。用来构造默认 User-Agent,同时也用来log。 当你使用 st 阅读全文
posted @ 2020-08-10 15:50 kuanleung 阅读(3) 评论(0) 推荐(0) 编辑
摘要:1. Item Pipeline 介绍 当Item 在Spider中被收集之后,就会被传递到Item Pipeline中进行处理 每个item pipeline组件是实现了简单的方法的python类,负责接收到item并通过它执行一些行为,同时也决定此Item是否继续通过pipeline,或者被丢弃 阅读全文
posted @ 2020-08-10 15:50 kuanleung 阅读(8) 评论(0) 推荐(0) 编辑
摘要:main from scrapy.cmdline import execute execute('scrapy crawl zw'.split()) zw.py import scrapy class ZwSpider(scrapy.Spider): name = 'zw' allowed_doma 阅读全文
posted @ 2020-08-10 15:39 kuanleung 阅读(33) 评论(0) 推荐(0) 编辑
摘要:maoyan.py import scrapy class MaoyanSpider(scrapy.Spider): name = 'maoyan' allowed_domains = ['maoyan.com'] start_urls = ['https://maoyan.com/films?sh 阅读全文
posted @ 2020-08-09 11:53 kuanleung 阅读(4) 评论(0) 推荐(0) 编辑
摘要:python 非官方包下载地址 点击加载地址 https://www.lfd.uci.edu/~gohlke/pythonlibs/ 阅读全文
posted @ 2020-08-08 10:55 kuanleung 阅读(2) 评论(0) 推荐(0) 编辑
摘要:import requests from fake_useragent import UserAgent from lxml import etree #url管理 class URLManger(object): def __init__(self): self.new_url=[] self.o 阅读全文
posted @ 2020-08-08 10:38 kuanleung 阅读(4) 评论(0) 推荐(0) 编辑
摘要:import requests from fake_useragent import UserAgent from lxml import etree url='' header={ 'User-Agent' : UserAgent().Chrome } response= requests.get 阅读全文
posted @ 2020-08-08 10:37 kuanleung 阅读(4) 评论(0) 推荐(0) 编辑
摘要:Installation Do I need to install pip? pip is already installed if you are using Python 2 >=2.7.9 or Python 3 >=3.4 downloaded from python.org or if y 阅读全文
posted @ 2020-08-02 20:53 kuanleung 阅读(6) 评论(0) 推荐(0) 编辑
摘要:from selenium import webdriver from lxml import etree from time import sleep from random import randint url ='https://search.jd.com/Search?keyword=%E6 阅读全文
posted @ 2020-08-02 18:12 kuanleung 阅读(5) 评论(0) 推荐(0) 编辑
摘要:from selenium import webdriver from time import sleep from lxml import etree from random import randint edge = webdriver.Edge() edge.get("https://www. 阅读全文
posted @ 2020-08-02 14:13 kuanleung 阅读(4) 评论(0) 推荐(0) 编辑
摘要:1. 数据的提取 1.1 控制台打印 import scrapy class DoubanSpider(scrapy.Spider): name = 'douban' allwed_url = 'douban.com' start_urls = [ 'https://movie.douban.com 阅读全文
posted @ 2020-08-01 10:15 kuanleung 阅读(4) 评论(0) 推荐(0) 编辑
摘要:1 Scrapy提取项目 从网页中提取数据,Scrapy 使用基于 XPath 和 CSS 表达式的技术叫做选择器。以下是 XPath 表达式的一些例子: 这将选择 HTML 文档中的 <head> 元素中的 <title> 元素 /html/head/title 这将选择 <title> 元素中的 阅读全文
posted @ 2020-08-01 10:15 kuanleung 阅读(4) 评论(0) 推荐(0) 编辑
摘要:1 基本使用 1.1 创建项目 运行命令: scrapy startproject myfrist(your_project_name) 文件说明: 名称作用scrapy.cfg项目的配置信息,主要为Scrapy命令行工具提供一个基础的配置信息。(真正爬虫相关的配置信息在settings.py文件中 阅读全文
posted @ 2020-08-01 10:14 kuanleung 阅读(3) 评论(0) 推荐(0) 编辑
摘要:参考文章 下载的exe文件修改名字为MicrosoftWebDriver.exe 阅读全文
posted @ 2020-08-01 09:36 kuanleung 阅读(5) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示