python模块
python内置模块、第三方模块
种花童心
这个作者很懒,什么都没留下…
展开
-
python 模块fnmatch
fnmatch 模块下的 fnmatch() 函数要求两个参数:文件名,以及文件名模式,返回的是布尔值。文件名模式中,支持 * 符号匹配任意字符。结合列表生成式,我们就可以快速过滤出符合条件的文件名了。from fnmatch import fnmatchpath='...'files = os.listdir(path)deps = [i for i in files if fnmatch(i, "*共同内容.xlsx")]print(deps)...原创 2021-01-01 18:56:38 · 532 阅读 · 0 评论 -
python-第三方模块openpyxl
功能Excel 文件的读取与写入.特点是功能齐全,处理速度快,与 Excel 软件本身的设置高度对应安装pip install -i https://pypi.tuna.tsinghua.edu.cn/simple openpyxl方法openpyxl.load_workbook(path)cell(m, n)要求两个参数,行标和列标,cell(m, n) 的意思是位于第 m 行,第 n 列的单元格示例import openpyxl# 工作表的路径path = '。。。。原创 2020-12-30 21:02:48 · 303 阅读 · 0 评论 -
python-第三方模块yagmail
功能:自动化发送邮件代码示例:# 导入 yagmail 模块import yagmail# 连接邮箱服务器yag = yagmail.SMTP(user='[email protected]', password='xxxxxx', host='smtp.qq.com')# 邮件内容yag.send(to=['[email protected]'], subject='Python 发送邮件', contents='你好,Python')# 邮件内容,含附件yag.send( to=[first原创 2020-12-30 19:37:08 · 321 阅读 · 0 评论 -
python-内置模块os
文章目录模块定义方法os.chdir()os.getcwd()os.listdir()os.mkdir()os.rename()模块定义os:可以与操作系统进行交互方法os.chdir()功能:将工作目录移至指定路径代码 import os path='d:/users/2019 ' os.chdir(path) os.getcwd()功能:获取当前的工作路径os.listdir()功能:列举出指定目录下的所有文件os.mkdir()功能:创建目录os.re原创 2020-12-29 16:32:18 · 95 阅读 · 0 评论