
python
文盲青年
好友推荐博客:https://www.cnblogs.com/johnnyzen(千千寰宇)
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
TOTP算法原理与实现
第 19 个字节(最后一个字节)的值为 0x5A(十六进制):原创 2025-05-29 15:38:39 · 330 阅读 · 0 评论 -
利用matplotlib与numpy画函数图像
【代码】利用matplotlib与numpy画函数图像。原创 2025-03-04 17:56:58 · 200 阅读 · 0 评论 -
python通过正则匹配SQL
匹配单引号或分号之外的字符。:匹配单引号包裹的字符串。:匹配 1 次或多次。,并且可以多次出现。原创 2024-12-25 11:21:41 · 444 阅读 · 0 评论 -
unicode中文互转
【代码】unicode中文互转。原创 2024-08-19 14:35:00 · 430 阅读 · 0 评论 -
python单例模式logger
这样可以避免创建多个日志记录器实例导致的重复日志输出问题。通过 hasattr 检查和 if 条件,我们实现了一个懒加载的单例模式,确保日志记录器实例只创建一次。的用法,用于检查某个对象是否具有指定的属性。在这个上下文中,它用来检查 get_logger 函数对象是否有 logger 属性。函数在整个应用程序中只创建一个日志记录器实例,即使。是一个 Python 内置函数。是我们要检查的属性名称。原创 2024-08-14 23:07:20 · 668 阅读 · 0 评论 -
python操作excel
【代码】python操作excel。原创 2024-08-07 16:35:47 · 188 阅读 · 0 评论 -
python查找内容在文件中的第几行(利用了滑动窗口)
我们可以看到①号,从1开始,可以从数字2(滑动1次),滑到数字6(滑动5次)例如文件总共为10行,而内容行数为5行,那么滑动的次数为5次(的i即为滑动次数)。原创 2024-05-23 11:58:21 · 636 阅读 · 0 评论 -
python多关键词、多文件后缀查找文件
【代码】python多关键词、多文件后缀查找文件。原创 2024-05-20 10:44:26 · 212 阅读 · 0 评论 -
python多线程测试
【代码】python多线程测试。原创 2024-05-16 17:58:49 · 118 阅读 · 0 评论 -
改变图片分辨率
【代码】改变图片分辨率。原创 2024-05-09 11:19:55 · 483 阅读 · 0 评论 -
conda常用命令
创建一个名为deeplearning的环境,python版本为3.7。仅删除deeplearning环境里的requests依赖。在conda 命令窗口中输入命令创建永久源。如果实在安装不上,则可以离线安装,在。切换到deeplearning环境。删除deeplearning环境。示例:安装jsonpath_ng。5、在激活conda后,使用。安装requests依赖。1、确保conda环境是。如果切换报错可以先试试。1、清理Conda环境。替换为文件的实际路径,6、列出可供安装的版本。原创 2023-08-22 11:02:06 · 5483 阅读 · 0 评论 -
mysql转达梦、神通、金仓—ddl语句 脚本
【代码】mysql转达梦的python脚本。原创 2024-03-13 11:29:57 · 1218 阅读 · 0 评论 -
python推导式
【代码】python推导式。原创 2024-03-06 10:35:36 · 168 阅读 · 0 评论 -
python递归遍历所有文件
【代码】递归遍历所有文件。原创 2023-11-02 16:48:13 · 368 阅读 · 0 评论 -
python将object转为json
python obj json原创 2022-10-24 13:01:45 · 369 阅读 · 0 评论 -
centos7安装python3
Centos7安装Python3.7全部操作都在root用户下执行1.安装编译相关工具yum -y groupinstall "Development tools"yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-develyum install libffi-deve转载 2022-02-16 16:50:26 · 179 阅读 · 0 评论 -
安装 chromedriver 依赖(linux使用selenium时报错)linux Service /usr/local/mine/notify/chromedriver unexpectedly
https://blog.youkuaiyun.com/a1368783069/article/details/80630630/转载 2021-11-03 22:23:04 · 1608 阅读 · 0 评论 -
Python Selenium库使用
https://blog.youkuaiyun.com/weixin_36279318/article/details/79475388转载 2021-11-02 22:22:35 · 107 阅读 · 0 评论 -
python连接数据库测试
pip install mysql-connectorimport mysql.connectormydb = mysql.connector.connect( host="localhost", user="root", passwd="123456")cursor = mydb.cursor()cursor.execute("use education")cursor.execute("select * from sys_user limit 5")for原创 2021-01-11 18:14:25 · 685 阅读 · 0 评论 -
冒泡排序(python版)
import randomattr = [3, 2, 5, 8, 6, 9, 9, 13, 11, 6]# attr = [random.randint(1, 10) for x in range(0, 10)]print(attr)for i in range(len(attr) - 1): for j in range(len(attr) - 1 - i): if attr[j] > attr[j + 1]: attr[j], attr[原创 2020-11-03 12:27:00 · 283 阅读 · 0 评论 -
python实现十大经典排序算法
python实现十大经典排序算法转载 2020-10-28 12:50:57 · 168 阅读 · 0 评论 -
Matplotlib绘图时x轴标签重叠的解决办法
Matplotlib绘图时x轴标签重叠的解决办法转载 2020-10-17 13:21:37 · 3301 阅读 · 0 评论 -
python爬取html并且保存到文件(简洁)
from urllib import requestresponse = request.urlopen("http://www.baidu.com/") # 打开网站fi = open("project.txt", 'w') # open一个txt文件page = fi.write(str(response.read())) # 网站代码写入fi.close()原创 2020-10-12 14:30:55 · 1959 阅读 · 0 评论 -
python内置异常结构
BaseException +-- SystemExit +-- KeyboardInterrupt +-- GeneratorExit +-- Exception +-- StopIteration +-- StopAsyncIteration +-- ArithmeticError | +-- FloatingPointError | +-- OverflowError | +-- ZeroDivision原创 2020-09-27 19:32:39 · 221 阅读 · 0 评论 -
python实现字符串替换
import osdef file_replace(file_name, rep_word, new_word): f_read = open(file_name) content = [] count = 0 for line in f_read: if rep_word in line: count = count + line.count(rep_word) line = line.replace(r原创 2020-09-27 14:19:31 · 692 阅读 · 0 评论 -
检测指定目录下后缀为.py的文件
import osimport os.pathls = []print(os.listdir('./..'))def getAppointFile(path, ls): fileList = os.listdir(path=path) try: for tmp in fileList: # 遍历path下条目:tmp: dir 、 a.txt 、 test.py # 拼接完整路径:pathTmp: /tmp/dir原创 2020-09-27 11:58:45 · 293 阅读 · 0 评论 -
使用pickle实现一个管理系统
import picklefrom os import pathdatafile = 'person.data'line = '======================================='message = '''=======================================Welcome bookmark: press 1 to show list press 2 to add people press 3 to edit peop原创 2020-09-25 18:59:29 · 189 阅读 · 0 评论 -
python文件读写的几种模式
模式描述r以只读方式打开文件。文件的指针将会放在文件的开头。这是默认模式。rb以二进制格式打开一个文件用于只读。文件指针将会放在文件的开头。r+打开一个文件用于读写。文件指针将会放在文件的开头。rb+以二进制格式打开一个文件用于读写。文件指针将会放在文件的开头。w打开一个文件只用于写入。如果该文件已存在则打开文件,并从开头开始编辑,即原有内容会被删除。如果该文件不存在,创建新文件。wb以二进制格式打开一个文件只用于写入。如果该文件已存在则打开文件...原创 2020-09-23 10:15:05 · 1119 阅读 · 0 评论 -
python搜索路径及其查看方式
当我们使用import语句的时候,Python解释器是怎样找到对应的文件的呢?这就涉及到Python的搜索路径,搜索路径是由一系列目录名组成的,Python解释器就依次从这些目录中去寻找所引入的模块。这看起来很像环境变量,事实上,也可以通过定义环境变量的方式来确定搜索路径。搜索路径是在Python编译或安装的时候确定的,安装新的库应该也会修改。搜索路径被存储在sys模块中的path变量,做一个简单的实验,在交互式解释器中,输入以下代码:#!/usr/bin/python3import sysl原创 2020-09-22 11:39:12 · 3236 阅读 · 0 评论 -
迭代器与生成器yield
https://www.runoob.com/python3/python3-iterator-generator.html转载 2020-09-19 16:13:56 · 139 阅读 · 0 评论 -
python中的str.count与str.endsWith的索引值问题
str.endswith(suffix[, start[, end]])start 参数以 0 为第一个字符索引值。end 参数以 1 为第一个字符索引值。print('01234'.endswith('234', 0, 4))>>> Falseprint('01234'.endswith('234', 0, 5))>>> True另外在count函数中也是一样...原创 2020-09-18 19:20:24 · 232 阅读 · 0 评论 -
Python 中关于 round 函数的小坑
https://www.runoob.com/w3cnote/python-round-func-note.html转载 2020-09-18 11:07:16 · 201 阅读 · 0 评论 -
superset安装与使用
使用教程源码安装转载 2020-09-17 13:56:42 · 268 阅读 · 0 评论 -
python的flask框架
https://blog.youkuaiyun.com/u014793102/article/details/80372815转载 2020-09-17 11:16:13 · 136 阅读 · 0 评论 -
Python中的逻辑运算符及True、False、None优先级关系
定义以下变量示例1: 结果为示例2: 结果为示例3: 结果为示例4: 结果为。原创 2019-09-08 11:32:36 · 2526 阅读 · 1 评论