![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
文盲青年
天苍苍,野茫茫,女扮男装耍流氓
展开
-
python查找内容在文件中的第几行(利用了滑动窗口)
我们可以看到①号,从1开始,可以从数字2(滑动1次),滑到数字6(滑动5次)例如文件总共为10行,而内容行数为5行,那么滑动的次数为5次(的i即为滑动次数)。原创 2024-05-23 11:58:21 · 408 阅读 · 0 评论 -
python多关键词、多文件后缀查找文件
【代码】python多关键词、多文件后缀查找文件。原创 2024-05-20 10:44:26 · 90 阅读 · 0 评论 -
python多线程测试
【代码】python多线程测试。原创 2024-05-16 17:58:49 · 82 阅读 · 0 评论 -
改变图片分辨率
【代码】改变图片分辨率。原创 2024-05-09 11:19:55 · 400 阅读 · 0 评论 -
一个基于API的简单ocr示例
利用百度的。原创 2024-04-10 10:35:50 · 156 阅读 · 0 评论 -
conda常用命令
创建一个名为deeplearning的环境,python版本为3.7。如果只是想删除环境里的某个依赖,可以使用如下命令。切换到deeplearning环境。原创 2023-08-22 11:02:06 · 1987 阅读 · 0 评论 -
mysql转达梦、神通、金仓—ddl语句 脚本
【代码】mysql转达梦的python脚本。原创 2024-03-13 11:29:57 · 423 阅读 · 0 评论 -
python推导式
【代码】python推导式。原创 2024-03-06 10:35:36 · 127 阅读 · 0 评论 -
python递归遍历所有文件
【代码】递归遍历所有文件。原创 2023-11-02 16:48:13 · 250 阅读 · 0 评论 -
python将object转为json
python obj json原创 2022-10-24 13:01:45 · 306 阅读 · 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 · 153 阅读 · 0 评论 -
安装 chromedriver 依赖(linux使用selenium时报错)linux Service /usr/local/mine/notify/chromedriver unexpectedly
https://blog.csdn.net/a1368783069/article/details/80630630/转载 2021-11-03 22:23:04 · 1164 阅读 · 0 评论 -
Python Selenium库使用
https://blog.csdn.net/weixin_36279318/article/details/79475388转载 2021-11-02 22:22:35 · 68 阅读 · 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 · 633 阅读 · 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 · 243 阅读 · 0 评论 -
python实现十大经典排序算法
python实现十大经典排序算法转载 2020-10-28 12:50:57 · 122 阅读 · 0 评论 -
Matplotlib绘图时x轴标签重叠的解决办法
Matplotlib绘图时x轴标签重叠的解决办法转载 2020-10-17 13:21:37 · 3162 阅读 · 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 · 1897 阅读 · 0 评论 -
python内置异常结构
BaseException +-- SystemExit +-- KeyboardInterrupt +-- GeneratorExit +-- Exception +-- StopIteration +-- StopAsyncIteration +-- ArithmeticError | +-- FloatingPointError | +-- OverflowError | +-- ZeroDivision原创 2020-09-27 19:32:39 · 178 阅读 · 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 · 605 阅读 · 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 · 252 阅读 · 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 · 144 阅读 · 0 评论 -
python文件读写的几种模式
模式描述r以只读方式打开文件。文件的指针将会放在文件的开头。这是默认模式。rb以二进制格式打开一个文件用于只读。文件指针将会放在文件的开头。r+打开一个文件用于读写。文件指针将会放在文件的开头。rb+以二进制格式打开一个文件用于读写。文件指针将会放在文件的开头。w打开一个文件只用于写入。如果该文件已存在则打开文件,并从开头开始编辑,即原有内容会被删除。如果该文件不存在,创建新文件。wb以二进制格式打开一个文件只用于写入。如果该文件已存在则打开文件...原创 2020-09-23 10:15:05 · 1046 阅读 · 0 评论 -
python搜索路径及其查看方式
当我们使用import语句的时候,Python解释器是怎样找到对应的文件的呢?这就涉及到Python的搜索路径,搜索路径是由一系列目录名组成的,Python解释器就依次从这些目录中去寻找所引入的模块。这看起来很像环境变量,事实上,也可以通过定义环境变量的方式来确定搜索路径。搜索路径是在Python编译或安装的时候确定的,安装新的库应该也会修改。搜索路径被存储在sys模块中的path变量,做一个简单的实验,在交互式解释器中,输入以下代码:#!/usr/bin/python3import sysl原创 2020-09-22 11:39:12 · 2725 阅读 · 0 评论 -
迭代器与生成器yield
https://www.runoob.com/python3/python3-iterator-generator.html转载 2020-09-19 16:13:56 · 100 阅读 · 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 · 176 阅读 · 0 评论 -
Python 中关于 round 函数的小坑
https://www.runoob.com/w3cnote/python-round-func-note.html转载 2020-09-18 11:07:16 · 158 阅读 · 0 评论 -
superset安装与使用
使用教程源码安装转载 2020-09-17 13:56:42 · 231 阅读 · 0 评论 -
python的flask框架
https://blog.csdn.net/u014793102/article/details/80372815转载 2020-09-17 11:16:13 · 99 阅读 · 0 评论 -
Python中的逻辑运算符及True、False、None优先级关系
python中的True、False、None有以下关系: True > None > False定义以下变量a=Trueb=Nonec=False示例1: 结果为None a and b示例2: 结果为True a or b示例3: 结果为False b and c示例4: 结果为None b or c...原创 2019-09-08 11:32:36 · 2168 阅读 · 0 评论