上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 15 下一页
  2020年5月29日
摘要: 一、传入数据 tensor只能传入数据 可以传入现有的数据列表或矩阵 import torch # 当是标量时候,即只有一个数据时候,[]括号是可以省略的 torch.tensor(2) # 输出: tensor(2) # 如果是向量或矩阵,必须有[]括号 torch.tensor([2, 3]) 阅读全文
posted @ 2020-05-29 23:46 jaysonteng 阅读(2718) 评论(0) 推荐(0) 编辑
摘要: 玩爬虫,怎么能少了scrapy框架呢。scrapy框架被称为是复杂并好用的爬虫框架。 当初学框架的时候是一头雾水,一旦实战成功过后,感觉瞬间打通了任督二脉,很有成就感。 接下来,将对scrapy框架爬虫代码编写流程做简要说明: 目录 一、新建工程 二、新建spider 三、定义所需爬取字段 四、解析 阅读全文
posted @ 2020-05-29 21:59 jaysonteng 阅读(2407) 评论(1) 推荐(1) 编辑
摘要: 在python中,等号作用是引用对象地址对应的对象 python中的数据分为可变类型和不可变类型: 可变类型:可列表、字典 不可变数据类型:字符串String、浮点型Float、整型Int、元祖Tuple。 对于不可变类型数据来说,其内存地址是不变的 # 比如: id(3) # 通过id查看数据内存 阅读全文
posted @ 2020-05-29 16:43 jaysonteng 阅读(360) 评论(0) 推荐(0) 编辑
摘要: 出现此情况原因: 1、说明x在其他函数中定义过,但x不是全局变量。(或者是多线程调用本函数,因为共享变量,也会报此错误) 2、变量在本函数中,在其调用之前的if语句中被定义过,但由于某次执行,不满足条件,使得x未进入过if语句,从而使得a未真正意义上被定义,所以报此错误。 比如: def func1 阅读全文
posted @ 2020-05-29 14:43 jaysonteng 阅读(910) 评论(0) 推荐(0) 编辑
  2020年5月20日
摘要: 所需安装的库(pypinyin):pip install pypinyin 代码如下: import pypinyin # 不带声调的(style=pypinyin.NORMAL) def pinyin(word): s = '' for i in pypinyin.pinyin(word, sty 阅读全文
posted @ 2020-05-20 14:53 jaysonteng 阅读(428) 评论(0) 推荐(0) 编辑
  2020年5月12日
摘要: import timeimport threadingfrom threading import Threadfrom concurrent.futures import ThreadPoolExecutor, wait, ALL_COMPLETED, as_completeddef sleep_t 阅读全文
posted @ 2020-05-12 18:00 jaysonteng 阅读(155) 评论(0) 推荐(0) 编辑
摘要: import time from multiprocessing import Pool from concurrent.futures import ThreadPoolExecutor, wait, ALL_COMPLETED, as_completed def thread_func(data 阅读全文
posted @ 2020-05-12 16:41 jaysonteng 阅读(5402) 评论(0) 推荐(0) 编辑
摘要: 思路: 1、获取带滑块的图片 2、获取不带滑块、完整的图片 3、比较两张图片中不一样的地方,找到滑块的坐标 4、通过滑块坐标来拖动浏览器 代码: import random import time from PIL import Image from io import BytesIO import 阅读全文
posted @ 2020-05-12 11:38 jaysonteng 阅读(2490) 评论(0) 推荐(0) 编辑
摘要: 思路: 1、先将DataFrame数据转换为numpy 2、通过numpy来修改对角线值 3、再将数据转换为DataFrame 代码: import pandas as pd import numpy as np # 数据 df = pd.DataFrame(np.arange(16).reshap 阅读全文
posted @ 2020-05-12 10:58 jaysonteng 阅读(1817) 评论(0) 推荐(0) 编辑
  2020年5月4日
摘要: get和post是http请求的两种基本方法,最直观的区别就是get把参数包含在url中,post是通过request body传递参数。 1、get在浏览器回退时候是无害的,而post会再次提交请求 2、get请求只能进行url编码,而post支持多种编码方式 3、get请求在url中传送的参数是 阅读全文
posted @ 2020-05-04 10:23 jaysonteng 阅读(236) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 15 下一页