python库
文章平均质量分 65
sandalphon4869
这个作者很懒,什么都没留下…
展开
-
python -m http.server 8000
文章目录# 默认分享当前目录及其子目录下的文件,端口8000python -m http.server 8000# 指定目录python -m http.server 8000 --directory C: 浏览器访问http://192.168.0.251:8000/,网速拉满,可以直接下载文件、浏览文本内容、查看图片、甚至看视频。...原创 2021-07-06 12:38:44 · 2571 阅读 · 3 评论 -
subprocess.py报错FileNotFoundError
Traceback (most recent call last): File "a.py", line 13, in <module> File "airtest\core\api.py", line 132, in auto_setup File "airtest\core\api.py", line 68, in connect_device File "airtest\core\api.py", line 37, in init_device File "airtes原创 2021-07-03 20:20:54 · 3742 阅读 · 5 评论 -
python库之airtest和pocoui
文章目录一、简介安装airtest和poco的区别二、airtest连接设备日志等级基本按键三、Poco一、简介安装pip install airtestpip install pocouiairtest和poco的区别airtest是基于图像识别来锁定位置的,而poco是基于在整体画面的控件节点关系的。二、airtest连接设备from airtest.core.api import *from airtest.cli.parser import cli_setupif not原创 2021-05-31 08:28:28 · 3280 阅读 · 3 评论 -
python库之状态机transitions
文章目录一、简介transitions库状态机二、逐步创建创建对象添加state添加transition三、直接初始化创建四、运行输出当前状态判断当前状态调用transitions强行移动状态附录什么叫做初始状态已经进入一、简介transitions库pip install transitions状态机state:状态节点transition:用于从一个状态节点移动到另一个状态节点二、逐步创建创建对象创建一个继承object的类Number的实体对象number,然后调用transit原创 2021-05-28 12:16:07 · 1762 阅读 · 1 评论 -
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.al
文章目录情况一:返回的是数组情况二:list(numpy数组)这是numpy数组比较的问题情况一:返回的是数组import numpy as npa = np.array([1, 2, 3])b = np.array([1, 5, 6])if a == b: pass因为a==b的结果是[True False False]。解决方案是:.any():只要有一个位置的元素True就True。.all():每个位置的元素都True才True。print((a == b).a原创 2021-03-24 11:44:49 · 3263 阅读 · 0 评论 -
python库配置文件ini之configparser
文章目录描述写读描述第三方库:pip install configparser配置文件example.ini格式,比如[DEFAULT]serveraliveinterval = 45compression = yescompressionlevel = 9[bitbucket.org]user = hg[topsecret.server.com]port = 50022forwardx11 = no写# -*- coding: utf-8 -*-impo原创 2021-03-07 12:32:49 · 205 阅读 · 1 评论 -
Python库之python程序的打包
文章目录描述安装参数说明One-Folder模式和One-File模式调出控制台窗口与否描述第三方库,要自己安装。将Python程序打包成标准的可执行文件,这些文件可以在没有安装Python的计算机上运行。安装pip install pyinstaller参数说明详细参数说明:https://pyinstaller.readthedocs.io/en/stable/usage.html常用:参数作用-h, --help显示帮助-D, --onedirO原创 2021-03-06 16:34:04 · 1802 阅读 · 0 评论 -
python 利用os统计文件夹下的所有文件夹或文件数目
import ospath ="E:\\CodeProject\\Git\\Honeysuckle"for _ in os.listdir(path): # 文件、文件夹名字 print(_)count = len(os.listdir(path)) # 数量原创 2021-01-27 18:04:11 · 4318 阅读 · 0 评论 -
Use Python to get free Internet Protocol
文章目录attributedomesticforeignattributeTechnology:threadingfake useragentUsage:Even u get a ip that this program output, but the free ip is hard to maintain stability.domestic# 建立属于自己的开放代理IP池import requestsimport randomimport timefrom lxml imp原创 2021-01-27 14:02:37 · 160 阅读 · 0 评论 -
python库之线程threading
文章目录一、函数式二、类式Knowledge一、函数式import threadingdef get_i_lists(i,i_lists): i_lists.append(i) passif __name__ == '__main__': threads = [] i_lists = [] for i in range(10): t = threading.Thread(target=get_i_lists,args=(i,i_list原创 2021-01-26 13:09:56 · 124 阅读 · 0 评论 -
python库之股票行情tushare
文章目录pro设置沪深股票的历史行情大盘指数的历史行情某日的沪深各股票行情pip install tushareimport tushare as ts两个网站:http://tushare.org/trading.htmlhttps://tushare.pro/pro设置去注册一个就有了。https://tushare.pro/register?reg=414178ts.set_token('xxxxxxxxxxxxxxxxxxxxxx')pro = ts.pro_api()沪原创 2021-01-12 09:40:52 · 383 阅读 · 0 评论 -
python Django返回HTTP 301?
问题通过浏览器可以正常访问django页面,而通过http.client请求django的页面,却返回301:[29/Aug/2020 17:56:14] "GET /post HTTP/1.1" 301 0解决方案1.手动url尾部收了"/",加上就OK了:import http.clientcon = http.client.HTTPConnection('192.168.0.105:8080')con.request("GET", "/logtest/logging/",'',{})原创 2020-08-29 17:59:20 · 2377 阅读 · 0 评论 -
python库之pyautogui
文章目录一、安装1.问题百出2.成功二、使用1.屏幕和鼠标操作1.1.尺寸1.2.鼠标位置1.3.移动鼠标1.3.1.绝对位置和保护措施FailSafeException1.3.2.相对位置一、安装1.问题百出python3 -m pip install pyautogui问题:最新版0.9.50(2020//07/31)这个是下载pyscreeze期间出现了问题。那就手动下python3 -m pip install pyscreeze以此类推,pygetwindow、PyTwee原创 2020-07-31 10:45:39 · 2087 阅读 · 3 评论 -
ImportError: No module named ‘_tkinter‘, please install the python3-tk package
先更新:sudo apt-get update安装sudo apt-get install python3-tk提示还没有’_tkinter’,这时只要把python3修改成对应的python版本号,比如我的是python3.5,重新输入sudo apt-get install python3.5-tk原创 2020-07-30 17:20:44 · 670 阅读 · 0 评论 -
Defaulting to user installation because normal site-packages is not writeable
出错情况:pip install XXXpip3 install XXX改成:python -m install XXXpython3 -m install XXX原创 2020-07-30 16:42:03 · 62659 阅读 · 31 评论 -
python库之下载Jupyter编辑器
文章目录一、win10安装jupyter一、win10安装下载python -m pip install opencv-python -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com验证虽然下的是opencv4.2.0,但模块的名字还是cv2。因为2不是表示版本,而是为了强调底层实现的C API(由cv前缀表示)和C++ API之间的差异(用cv2前缀表示)。import cv2p原创 2020-07-30 08:46:48 · 1832 阅读 · 0 评论 -
Linux上python/python2/python3/python3.m和pip/pip3/pip3.m
文章目录一、说法一二、另一种说法一、说法一如果同时装有 python2 和 python3①pip 默认给 python2 用。②pip3 指定给 python3 用。③如果同时安装多个3的版本的话,比如3.5 3.6 3.7。则用pip3明显不合适,这个时候就可以用pip+版本后缀来明确指出具体版本的pip了。如果只装有 python3pip和pip3、pip3.7是等价的。Python3.7 安装后pip pip3 pip3.7的区别二、另一种说法使用which命令查看原创 2020-07-29 18:25:20 · 701 阅读 · 0 评论 -
Django局域网访问网页
文章目录一、Django修改1.核心修该(1)setting.py(2)urls.py2.其他二、查看ip地址一、Django修改1.核心修该(1)setting.py将ALLOWED_HOSTS修改成['*']:这样允许访问。ALLOWED_HOSTS = ['*']不然报错(2)urls.py'':因为你的设定端口是192.168.1.104:8000,就相当于后面不跟子域名,自然是空。2.其他<!DOCTYPE html><html lang="en原创 2020-07-26 23:30:52 · 1870 阅读 · 0 评论 -
python之生成字典和连接Wifi
文章目录一、生成字典二、连接Wifi一、生成字典# -*- coding: utf-8 -*-import itertools as its# 单个字符的集合words="0123456789"# 每次任选一个字符,重复8次arrays = its.product(words, repeat = 8)# 写入txt文本文件dictionary = open("C:/Use...原创 2020-02-08 20:48:11 · 1557 阅读 · 0 评论 -
python之简单的爬取下载
文章目录import urllibimport requestsfrom bs4 import BeautifulSoup# 模仿正常浏览器的request headerheaders = { # 'user-agent': 'Mozilla / 5.0(Windows NT 10.0;Win64;x64) AppleWebKit / 537.36(KHTML, likeGecko) Chrome / 81.0.4044.122Safari / 537.36'}# 要访问的ht原创 2020-06-15 17:59:05 · 839 阅读 · 0 评论 -
python之读取文件:文本文件和二进制文件
文章目录一、文件类型二、常用操作1.打开文件1.1open函数1.2参数:模式 mode2.写入数据3.读取数据Reference一、文件类型二、常用操作1.打开文件1.1open函数open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)file:文件名称mode:文件处理方式buffering:读写文件的缓存模式。encodi原创 2020-06-15 09:38:45 · 5306 阅读 · 0 评论 -
Python程序读取命令行参数(sys和getopt)
文章目录一、一层难度1.sys 模块2.例子(1)基本特性(2)都是str类型(3)xxx.py及其之后的才是(4)空格和转移字符二、二层难度1.getopt模块(1)思想(2)函数2.例子一、一层难度这里我们只需要获取控制台输入的字符串是啥,直接抄过来。1.sys 模块import sys访问到所有的命令行参数:python xxx.py中xxx.py及其之后的才是,之前的不是。要编译的.py文件就是第一个参数。它的返回值sys.argv:列表(list)类型参数个数: l原创 2020-05-15 13:05:45 · 2112 阅读 · 0 评论 -
pip总结
文章目录python -m pip install --user --upgrade pip -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.compython -m pip install wheel -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com第一个是安装新的pip,使用python -m pi原创 2020-05-11 10:05:26 · 1259 阅读 · 0 评论 -
解决pip安装时速度慢的问题
文章目录一、源二、临时使用三、永久修改1.Linux下2.windows下一、源国内源:新版ubuntu要求使用https源,要注意。阿里云:http://mirrors.aliyun.com/pypi/simple/清华:https://pypi.tuna.tsinghua.edu.cn/simple中国科技大学 https://pypi.mirrors.ustc.edu.cn/s...转载 2020-04-22 14:26:55 · 4195 阅读 · 0 评论 -
python与adb(cmd命令如何执行)
文章目录一、adb二、python使用1.基本一、adbadb常用命令入门二、python使用1.基本库:import os使用命令:os.system('')# 库import os# adb shell xxx的封装def execute(cmd): adbShell = "adb shell {cmdStr}" str = adbShell.for...原创 2020-02-29 21:38:55 · 4337 阅读 · 0 评论 -
adb常用命令入门
文章目录一、链接问题1.kill-server与start-server2.显示二、常用1.adb push与adb pull2.install3.uninstall三、adb shell终端1.进入和退出2.input keyevent3.input tap4.input swipe6.screencap命令7.获取手机屏幕分辨率5.同linux文件系统(1)ls(2)pwd(3)cd(4)rm...原创 2019-09-29 20:53:41 · 1658 阅读 · 0 评论 -
python库matplotlib之plt画子图
文章目录plt_index:表示子图的序号。应该初始化为1,表示第一张图fig = plt.figure(figsize=(10,10)):表示初始化figure对象。figsize表示图像大小,单位英寸inch,默认为defaults to rcParams[“figure.figsize”] = [6.4, 4.8].ax = fig.add_subplot(4,1,plt_in...原创 2019-11-06 09:38:55 · 20380 阅读 · 1 评论 -
python库之pywin32
一、配置安装pip installer pywin32二、库函数win32api 提供了常用的用户APIwin32clipboard 提供了有关粘贴板的APIwin32console 提供了有关控制台的APIwin32gui 提供了有关windows用户界面图形操作的APIwin32service 提供了有关服务操作的APIwin32file 提供了有关...原创 2019-03-27 20:05:00 · 5025 阅读 · 1 评论 -
六、python库的使用
一、库的介绍Python计算生态=标准库+第三方库:(1)标准库:随解释器直接安装到操作系统的功能模块(2)第三方库:需要经过安装才能使用的功能模块(3)模块:库Library,包Package,模块Module二、库引用import(1)使用方法一:import <库名>#引入xxx库<库名>.<函数名>(<相关参...原创 2019-03-14 19:51:08 · 289 阅读 · 0 评论 -
python库之numpy(下)
目录三、通用函数:快速的元素级数组函数1.一元ufunc2.二元ufunc3.可以返回多个数组的ufunc4.out可选参数四、利用数组进行数据处理1.矢量化2.将条件逻辑表述为数组运算np.where()3.数学和统计方法(1)聚合计算aggregation(2)非聚合4.对布尔型数组中的True值计数5.排序(1)三种排序算法(...原创 2019-03-23 10:19:50 · 434 阅读 · 0 评论 -
python库之numpy(上)
目录一、numpy库介绍1.简介2.安装3.使用二、 ndarray0.性质1.创建ndarray(1)np.array()(2)np.zeros() 、ones()、empty()(3)np.arange()2.ndarray的数据类型(1)指定类型:(2) 转化类型:3.ndarray数组的运算4.数组的广播(不同shape的...原创 2019-03-20 17:11:27 · 928 阅读 · 0 评论 -
python库之random库(随机数函数)
文章目录一、random库二、函数(1)索引(2)random.seed([x])(3)random.randrange(m,n[,k])(4)random.choice(seq)(5)random.sample(seq,k)(6)random.shuffle(list)一、random库random库概述:random库是使用随机数的Python标准库伪随机数:采用梅森旋转算法...原创 2019-04-29 18:48:24 · 13299 阅读 · 4 评论 -
python之处理数学的函数
文章目录一、处理数学的函数1.自带的函数2.math库二、函数1.常数2.数学函数(1)数的处理(2)指数对数(3)函数集成(4)角度(5)随机数一、处理数学的函数1.自带的函数比如abs()求绝对值,round()四舍五入2.math库头文件import mathmath库的函数使用时必须加上"math.",如math.e,math.fabs()math库的函数的返回值大...原创 2019-04-29 18:49:53 · 360 阅读 · 0 评论 -
python库之autopy
文章目录一、安装的使用1.介绍2.安装3.使用3.官方英文文档二、屏幕at.screen1.总结2.scale()以及坐标点和像素点关系3.size()4.is_point_visible(x:float,y:float)5.get_color(x:float,y:float)三、鼠标at.mouse1.总结2.move(x,y)3.smooth_move(x,y)4.location()5.Bu...原创 2019-05-16 21:11:25 · 15050 阅读 · 2 评论 -
python之time
文章目录一、time1.介绍2.使用二、函数一、time1.介绍内置库2.使用import time二、函数函数参数作用sleep(t:float)t:暂停的秒数,单位秒暂停程序一段时间...原创 2019-05-16 22:33:23 · 129 阅读 · 0 评论 -
python库之turtle库官方文档入门
文章目录一、turtle库1.基本介绍2.turtle绘图原理3.官方文档二、函数纵览1.Turtle methods(1)Turtle motion三、turtle绘图窗体布局三、turtle空间坐标体系四、turtle角度坐标体系五、RGB色彩模式:六、turtle画笔控制函数七、其他命令八、例子1.太阳花2.七段数码管一、turtle库1.基本介绍turtle库:(1)1969...原创 2019-08-15 13:10:48 · 89090 阅读 · 13 评论 -
python库之turtle库例子
文章目录一、简单例子1.太阳花2.螺旋方阵3.彩色螺旋4.七段数码管二、官方例子1.打开方法2.bytedesign3.chaos4.clock5.colormixer6.forest7.fractalcurves9.lindenmayer10.minimal_hanoi11.nim12.paint14.peace15.penrose16.planet_and_moon17.rosette18.r...原创 2019-08-15 13:49:46 · 13953 阅读 · 1 评论 -
python库之matplotlib库
文章目录一、简介:1.安装二、matplotlib.pyplot1.简介2.import as3.参考三、图的元素设置0.总汇1.显示2.保存的图像分辨率3.标题文字4.网格5.边界6.刻度7.刻度精度???代码一、简介:1.安装pip install matplotlib二、matplotlib.pyplot1.简介matplotlib.pyplot是一个用于python编程语言...原创 2019-09-06 19:23:51 · 2219 阅读 · 1 评论 -
python库之pandas库
文章目录一、pandas1.as2.体系二、序列Series和数据框DataFrame1.Series创建(1)一维np数组(2)列表(3)字典(4)通过DataFrame中的某一行或某一列创建序列2.DataFrame(1)二维np数组(2)嵌套列表(3)字典(4)通过数据框的方式创建数据框三、索引1.设置索引(1)默认索引(2)查看索引(3)自定义索引2.通过索引值获取数据3.自动化对齐一...原创 2019-09-06 19:26:19 · 556 阅读 · 0 评论 -
python库之seaborn库
文章目录一、seaborn1.简介2.as3.网址二、加载数据1.自己的数据2.Seaborn 的示例数据集(snsn.load_dataset())一、seaborn1.简介seaborn是matplotlib的延伸和扩展,如果你知道matplotlib,你就已经掌握了Seaborn的大部分。seaborn特别地以数据可视化为目标。用matplotlib最大的困难是其默认的各种参数,...原创 2019-09-06 19:27:42 · 931 阅读 · 0 评论