一个扩展的、更强大的pathlib。

pathlib-mate的Python项目详细描述


Documentation Statushttps://travis-ci.org/MacHu-GWU/pathlib_mate-project.svg?branch=masterhttps://codecov.io/gh/MacHu-GWU/pathlib_mate-project/branch/master/graph/badge.svghttps://img.shields.io/pypi/v/pathlib_mate.svghttps://img.shields.io/pypi/l/pathlib_mate.svghttps://img.shields.io/pypi/pyversions/pathlib_mate.svghttps://img.shields.io/pypi/dm/pathlib_mate.svghttps://img.shields.io/badge/STAR_Me_on_GitHub!--None.svg?style=social
https://img.shields.io/badge/Link-Document-blue.svghttps://img.shields.io/badge/Link-API-blue.svghttps://img.shields.io/badge/Link-Source_Code-blue.svghttps://img.shields.io/badge/Link-Install-blue.svghttps://img.shields.io/badge/Link-GitHub-blue.svghttps://img.shields.io/badge/Link-Submit_Issue-blue.svghttps://img.shields.io/badge/Link-Request_Feature-blue.svghttps://img.shields.io/badge/Link-Download-blue.svg

欢迎使用pathlib_mate文档

pathlib是不同操作系统中一个非常棒的库处理路径。从python3.4开始它就被添加到标准库中。pathlib_mate提供了广泛的方法和属性,使pathlib更加强大和用户友好。

功能:

方便的属性访问器

>>>p=Path("/Users/username/test.py").>>>p.abspath/Users/username/test.py>>>p.basenametest.py>>>p.fnametest>>>p.ext.py>>>p.dirnameusername>>>p.dirpath/Users/username>>>p.size1500>>>p.size_in_text1.46KB>>>p.create_datetimedatetime(2018,1,15,8,30,15)>>>p.md5415f12f07a7e01486cc82856621e05bf>>>p.sha256d51512cb0ac71484c01c475409a73225d0149165024d7aac6d8e655eedf2c025>>>p.sha5127882fc375840cafa364eaf29dc424645b72fcdbe61fc3326c5afd98e70f696e4f390e0e3f159eac2cb60cedc0992ef7b5f8744a4481911e914a7c5b979e6de68

强大的路径搜索功能

>>>p=Path("/Users/username/Documents")>>>forpathinp.select_file(recursive=True)...>>>forpathinp.select_file(recursive=False)...>>>forpathinp.select_dir(recursive=True)...>>>forimage_fileinp.select_by_ext([".jpg",".png"])...>>>forbig_fileinp.select_by_size(min_size=1000000)...>>>forvideo_fileinp.select_video():...# You can customize the filter anyway you want>>>defpy_filter(p):return".py"==p.ext.lower()>>>forpy_fileinp.select_file(py_filter):...

eazy使用文件/目录操作

>>>p=Path("/Users/username/Documents/Readme.txt")# mutate>>>p.change(new_ext=".md")/Users/username/Documents/Readme.md>>>p.change(new_fname="Tutorial")/Users/username/Documents/Tutorial.txt>>>p.change(new_basename="README.rst")/Users/username/Documents/README.rst>>>p.change(new_dirname="Downloads")/Users/username/Downloads/Readme.txt>>>p.change(new_dirpath="/User/username/Downloads)/Users/username/Downloads/Readme.txt>>>p.change(new_abspath="/Users/username/Downloads/Readme.txt")/Users/username/Downloads/Readme.txt# copy>>>p.moveto(new_ext=".md",makedirs=True)# cut>>>p.copyto(new_ext=".md",makedirs=True)# delte>>>p.remove()

功能强大的生产工具

>>>p=Path("/Users/username/Documents/Github/pathlib_mate-project")>>>p.print_big_dir_and_big_file()...>>>p.file_stat(){"file":122,"dir":41,"size":619682}# file statistics, include sub folder>>>p.file_stat_for_all()# make an zip archive for the directory, auto naming>>>p.make_zip_archive()# make an zip archive for the directory, auto naming>>>p.backup()

安装

pathlib_mate在pypi上发布,所以您只需要:

$ pip install pathlib_mate

要升级到最新版本:

$ pip install --upgrade pathlib_mate

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
如何使用SeleniumWebDriver捕获特定元素的屏幕截图而不是整个页面?   WAS 8.5中的java JAXWS异步IO异常   java Android Studio无法解析数组适配器中的符号项   swing Java在运行时添加和删除按钮   java Spring Boot 2.0。x禁用特定配置文件的安全性   java这是我的最后一个代码,我在“if(Users[B].substring(0,1)==“1”){//Find String Cut Char Function”上遇到错误   单击菜单选项后打开“活动”时发生java错误   java Tic Tac Toe NullPointerException   java如何做数学题。随机进入for循环   java Http状态404错误处理spring mvc   java循环依赖双向@OneToMany JPA关系   java我可以在不重新启动项目的情况下添加servlet吗   java在蓝色/绿色部署中如何管理共享数据库?   这是一个系统。currentTimeMillis()是Java中时间性能的最佳度量?