
python
文章平均质量分 64
热门python知识分享
技术探索者
这个作者很懒,什么都没留下…
展开
-
Python:pyinstaller打包后,运行提示找不到运行库api-ms-win-core-path-l1-1-0.dll 之解决方案
Python:pyinstaller打包后,运行提示找不到运行库api-ms-win-core-path-l1-1-0.dll 之解决方案原创 2025-04-09 14:17:05 · 1002 阅读 · 0 评论 -
Python:pyqtgraph模块无python2_3问题的解决方法
Python:pyqtgraph模块无python2_3问题的解决方法原创 2024-12-03 14:38:25 · 424 阅读 · 0 评论 -
Python:pyqtgraph模块无GraphicsWindow问题的解决方法
Python:pyqtgraph模块无GraphicsWindow问题的解决方法原创 2024-12-03 13:50:10 · 466 阅读 · 0 评论 -
Python:pytorch指令安装时Could not find a version that satisfies the requirement xxx (from versions: none)
Python:pytorch指令安装时Could not find a version that satisfies the requirement xxx (from versions: none)原创 2024-11-03 20:24:07 · 8459 阅读 · 2 评论 -
Python:Building wheel for PyQt5-sip (pyproject.toml) did not run successfully解决方法
Python:Building wheel for PyQt5-sip (pyproject.toml) did not run successfully解决方法原创 2024-10-25 23:15:48 · 2060 阅读 · 1 评论 -
Python:from…import * 与 import 区别
Python:from…import * 与 import 区别原创 2024-10-17 13:57:30 · 691 阅读 · 0 评论 -
Python: with 语句
Python: with 语句原创 2024-10-12 17:11:55 · 586 阅读 · 0 评论 -
Python:一个列表分割成多个列表
Python:一个列表分割成多个列表原创 2024-10-11 13:58:19 · 3046 阅读 · 0 评论 -
Python:Numpy的fromfile、tofile方法---读写文件的强大工具
Python:Numpy的fromfile、tofile方法---读写文件的强大工具原创 2024-10-10 14:52:51 · 896 阅读 · 0 评论 -
Python: 修改源 知多少
Python: 修改源 知多少原创 2024-10-07 23:04:07 · 1767 阅读 · 0 评论 -
Python:lambda 函数详解 以及使用
Python:lambda 函数详解 以及使用原创 2024-09-27 10:29:25 · 3260 阅读 · 0 评论 -
Python3:ModuleNotFoundError: No module named ‘click‘
Python3:ModuleNotFoundError: No module named 'click'原创 2024-03-30 11:09:17 · 1164 阅读 · 0 评论 -
Python3:ModuleNotFoundError: No module named ‘elftools‘
Python3:ModuleNotFoundError: No module named ‘elftools‘原创 2024-03-30 11:03:53 · 636 阅读 · 0 评论 -
Python:实现日历功能
Python:实现日历功能原创 2023-10-25 22:37:23 · 2721 阅读 · 0 评论 -
Python:关于使用pip时报错:ImportError: cannot import name ‘InvalidSchemeCombination’ from ‘pip._internal.exc
Python:关于使用pip时报错:ImportError: cannot import name ‘InvalidSchemeCombination’ from ‘pip._internal.exc原创 2023-10-19 19:19:50 · 1597 阅读 · 0 评论 -
Python:随机生成多个两位数加减混合运算计算式
Python:随机生成多个两位数加减混合运算计算式原创 2022-11-27 21:26:43 · 3479 阅读 · 0 评论 -
Python:TypeError: list indices must be integers or slices, not str报错解决及原理
Python:TypeError: list indices must be integers or slices, not str报错解决及原理原创 2022-11-25 09:05:16 · 11980 阅读 · 1 评论 -
python:launchpadlib 1.10.13 requires testresources, which is not installed
launchpadlib 1.10.13 requires testresources, which is not installed原创 2022-05-31 10:09:50 · 4651 阅读 · 0 评论 -
Python:Cannot import name find_packages
Python:Cannot import name find_packages原创 2022-05-26 11:20:24 · 1194 阅读 · 1 评论 -
celery flower使用技巧
1、flower简介flower是基于web的监控和管理Celery的工具,和任务队列是隔离的,flower的运行并不会影响到任务队列的真正执行。flower作为celery后台任务的管理工具,将各个任务的执行情况、各个worker的健康状态进行实时监控并以可视化的方式展现。2、安装pip3 install flower3、使用celery以redis作为brokercelery flower --address=0.0.0.0 --port=5555 --broker=redis:原创 2020-09-23 19:02:40 · 8483 阅读 · 2 评论 -
Supervisor安装与配置
Supervisor(http://supervisord.org/)是用Python开发的一个client/server服务,是Linux/Unix系统下的一个进程管理工具,不支持Windows系统。它可以很方便的监听、启动、停止、重启一个或多个进程。用Supervisor管理的进程,当一个进程意外被杀死,supervisort监听到进程死后,会自动将它重新拉起,很方便的做到进程自动恢复的功能,不再需要自己写shell脚本来控制。因为Supervisor是Python开发的,安装前先检查一下系...转载 2020-08-31 18:17:28 · 702 阅读 · 0 评论 -
Python读取大文件解决方案
Python读取大文件解决方案背景用Python读取3GB文件的时候,用普通方式读取报错MemoryError,说明该无文件无法被装载在内存中发生溢出了。read和readlines都是将整个文件加入到内存中,文件较大时,会引发MemoryError逐行读取with open('filename', 'r', encoding = 'utf-8') as f: while True: ...原创 2020-08-06 19:55:50 · 466 阅读 · 0 评论 -
Python3 * 和 ** 运算符之我见
引言Python 中,* 和 ** 有以下四类用法。算数运算* 代表乘法** 代表乘方>>> 2 * 36>>> 2 ** 38函数形参*args 和 **kwargs 主要用于函数定义。可以将不确定数量的参数传递给一个函数。不确定的意思:预先不知道函数参数个数,即 函数调用者会传递多少个参数, 在这种场景下使用以上关键字。 *args 和**kwargs 是一个约定俗成的命名约定。python函数传递参数有两种方式:..原创 2020-11-19 15:06:11 · 318 阅读 · 0 评论 -
Python 的 r‘‘, b‘‘, u‘‘, f‘‘ 含义解析
字符串前加 rr"" 的作用是去除转义字符.即如果是“\n”那么表示一个反斜杠字符,一个字母n,而不是表示换行了。以r开头的字符,常用于正则表达式,对应着re模块。str1= 'input\n'str= r'input\n'print(str1)print(str)输出:inputinput\n字符串前加 b例:response = b'<h1>Hello World!</h1>' #b' ' 表示这是一个 bytes 对象作用...原创 2020-11-19 11:29:08 · 1387 阅读 · 0 评论 -
python3 读取文件时,报编码错误(illegal multibyte sequence )
问题现象: 有时当读取一个文件时,报出以下错误,很是捉急。UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 7205: invalid continuation byte问题原因:文件中含有utf-8或gbk无法编码的字符,或者是打开的编码不对。解决方法:解决方法一:用 utf-8 编码打开 (实际文件的编码方式)如下:open('d:/data/synopses_list_wiki.tx..原创 2020-11-11 12:35:09 · 5625 阅读 · 0 评论 -
python3 常用校验方法小结
0x00 校验一个字符串是否是合法IP地址ipv4举例:利用正则表达式来匹配def checkip(ip): p = re.compile('^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$') if p.match(ip): return True else: return False0x01 校验一个字符串是否为中文...转载 2020-11-06 16:14:34 · 685 阅读 · 0 评论 -
python3 ftplib模块知多少
ftplib模块之常用方法ftp登陆连接from ftplib import FTP #加载ftp模块ftp=FTP() #设置变量ftp.set_debuglevel(2) #打开调试级别2,显示详细信息ftp.connect("IP","port") #连接的ftp sever和端口ftp.login("user","password") #连接的用户名,密码prin...原创 2020-11-03 15:36:05 · 292 阅读 · 0 评论 -
python3 根据网卡名获取IP
如何根据网卡名获取到IPimport socket,struct,fcntl def get_ip(ifname): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) return socket.inet_ntoa(fcntl.ioctl(s.fileno(), 0x8915, struct.pack('256s', bytes(ifname[:15],'utf-8')))[20:24]) print("server ip原创 2020-09-29 13:46:07 · 1480 阅读 · 0 评论 -
python3 输出日志的正确打开方式(二)
自定义日志方式书写python日志 使用logging.config.fileConfig(),读取配置文件的方式,虽然提供了灵活方便的渠道,仅仅可以通过修改配置即可达到目的,但是对于需要自定义日志的同学显然满足不了要求。 且看自定义日志该如何写作,以下代码实现了根据不同模块,创建相应目录,日志文件的功能,日志文件命名为:模块_日志.log。1、创建log.pyimport loggingimport logging.handlersimport osim...原创 2020-09-21 10:19:04 · 372 阅读 · 0 评论 -
python3 输出日志的正确打开方式(一)
python中输出日志的形式一般有两种,一是简单的输出到终端,二是保存到文件中,而针对这些日志形式所选用的方式也多种多样。1、最简单的方式 print("testtesttest")2、使用logging.config.fileConfig() 创建配置文件 使用logging.config.fileConfig(),首先要创建配置文件,例如log.conf,添加如下内容。#log.conf###################keys###...原创 2020-09-17 19:37:55 · 3123 阅读 · 0 评论 -
Python 远程部署利器 Fabric 详解
From:http://python.jobbole.com/87241/From:Python模块学习 - fabric(Python3):https://www.cnblogs.com/xiao-apple36/p/9124292.htmlfabric官网英文文档:http://www.fabfile.org/fabric中文站点:http://fabric-chs.readthedocs.io/zh_CN/chs/python三大神器之一fabric使用:https://www.c..转载 2020-08-28 10:10:16 · 2534 阅读 · 1 评论 -
Python 代码调试技巧
Debug 对于任何开发人员都是一项非常重要的技能,它能够帮助我们准确的定位错误,发现程序中的 bug。python 提供了一系列 debug 的工具和包,可供我们选择。本文将主要阐述如何利用 python debug 相关工具进行 debug。使用 pdb 进行调试pdb 是 python 自带的一个包,为 python 程序提供了一种交互的源代码调试功能,主要特性包括设置断点、单步调试、进入函数调试、查看当前代码、查看栈片段、动态改变变量的值等。pdb 提供了一些常用的调试命令,详情见表 ...转载 2020-08-10 19:39:10 · 306 阅读 · 0 评论