上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 19 下一页
摘要: openpyxl库不能够处理xls格式excel文件,这里可以使用python自带的包xlrd来进行处理 1、导包 import xlrd 2、打开文件 df = xlrd.open_workbook("test.xls") 3、sheet操作 # 获取sheet表单名 ['sheet1','she 阅读全文
posted @ 2022-02-17 15:39 eliwang 阅读(2027) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8 from idna import unichr def all_to_half(all_string): """全角转半角""" half_string = "" for char in all_string: inside_code = ord(char) if in 阅读全文
posted @ 2021-12-23 20:25 eliwang 阅读(465) 评论(0) 推荐(0) 编辑
摘要: rocketmq-python 是一个基于 rocketmq-client-cpp 封装的 RocketMQ Python 客户端。 一、Producer #coding:utf-8import json from rocketmq.client import Producer, Message p 阅读全文
posted @ 2021-12-16 16:05 eliwang 阅读(4340) 评论(0) 推荐(0) 编辑
摘要: 对xlsx文件和csv文件进行相互转换,我们可以借助pandas来实现 一、安装pandas pip3 install pandas 二、xlsx文件转csv文件 import pandas as pd data = pd.read_excel('test.xlsx',index_col=0) # 阅读全文
posted @ 2021-12-02 12:09 eliwang 阅读(2243) 评论(0) 推荐(0) 编辑
摘要: 我们测试下3种插入操作方式的性能情况(以10000次为例): 1、每条数据都进行execute和commit 2、多次执行exectue,最后commit 3、使用executemany执行1次,然后commit1次 示例: # coding:utf-8 import time import pym 阅读全文
posted @ 2021-11-19 19:49 eliwang 阅读(275) 评论(0) 推荐(1) 编辑
摘要: pdfplumber不仅可以解析提取pdf文件中的文本,还可以提取表格 一、安装 pip3 install pdfplumber 二、使用 # coding:utf-8 import pdfplumber with pdfplumber.open('./test.pdf') as pdf: # 遍历 阅读全文
posted @ 2021-11-19 19:15 eliwang 阅读(3397) 评论(0) 推荐(0) 编辑
摘要: 我们经常在调用第三方库中的一些方法时,会提示该方法已弃用之类的warning,虽然能执行,但是看起来不太美观,如何过滤这些警告提示呢? warnings模块,调用warnings.filterwarnings()方法 from warnings import filterwarnings filte 阅读全文
posted @ 2021-11-15 13:58 eliwang 阅读(3041) 评论(0) 推荐(0) 编辑
摘要: 一、从命令行创建一个新的仓库 1、创建一个说明文件 touch README.md 2、首先使该目录成为git可以管理的目录 git init 3、添加所有文件到本地暂存区 git add . #(不要忘了后面的点".",表示所有文件及目录) # git add README.md 表示将 READ 阅读全文
posted @ 2021-11-05 14:12 eliwang 阅读(2256) 评论(0) 推荐(0) 编辑
摘要: 出现类似问题,是这个字节超出了utf-8的表示范围,出现了解码错误 解决方案:设置encoding = 'ISO-8859-1' 比如: with open('./xxx.txt',encoding='ISO-8859-1') as f: print(f.read()) 阅读全文
posted @ 2021-10-26 17:44 eliwang 阅读(4746) 评论(0) 推荐(0) 编辑
摘要: zipfile包是python中用来处理zip文件压缩和解压缩的 一、导包 import zipfile 二、zipfile.ZipFile类 z = ZipFile(file, mode="r", compression=ZIP_STORED, allowZip64=True,compressle 阅读全文
posted @ 2021-10-26 16:17 eliwang 阅读(3796) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 19 下一页