为什么挠脚心会痒| 骨髓穿刺能查出什么病| 高处不胜寒的胜是什么意思| 儿童办护照需要什么材料| 指导员是什么级别| 口舌生疮吃什么药最见效| 3月26日是什么节日| 甲功七项检查什么| 生物制剂是什么| 为什么会感染幽门螺杆菌| 黄毛是什么意思| 阴茎里面痒是什么原因| 五十八岁属什么生肖| 犬和狗有什么区别| 翠字五行属什么| 心脏房颤是什么原因| 吃海参有什么功效| 什么东西抗衰老最好| 鬼死了叫什么| 内分泌失调吃什么| 为什么会散光| 06年是什么年| 面瘫是什么引起的| 为什么镜子不能对着床| 避火图是什么| 1961年属什么生肖| 黄水疮是什么原因引起的| 拉尿有泡泡是什么原因| 甲钴胺不能和什么药一起服用| 北京大学校长是什么级别| 陆陆续续是什么意思| 吃什么可以解酒最快简单| 肾盂是什么意思| 习惯是什么意思| 查血糖是什么检查项目| 魔芋爽是什么做的| 睡前吃香蕉有什么好处| 老是想吐是什么原因| 老年人吃什么奶粉好| 头晕拉肚子是什么情况| 团长转业到地方是什么职务| 什么是b站| 心脏杂音是什么意思| 财主是什么意思| 什么的食物| 瘟神是什么意思| 白里透红的透是什么意思| perry是什么意思| 唯有读书高的前一句是什么| 胃食管反流有什么症状| 飞廉是什么意思| 木薯粉是什么东西| 吃什么避孕药可以推迟月经| 站着说话不腰疼什么意思| 香叶是什么树的叶子| 十月二十是什么星座| 沐雨栉风是什么生肖| 顺产收腹带什么时候用最佳| 一什么玉米| 大眼角痒是什么原因| 壬申日是什么意思| 中医是什么| 8月是什么季节| 金童玉女指什么生肖| px是什么意思| peak是什么牌子| 非洲割礼是什么| 办护照需要准备什么材料| 藏族信仰什么教| 肚脐眼下面疼是什么原因| 乌龟都吃什么| 形而上学什么意思| 五根手指叫什么| 什么什么的落叶| 好运连绵是什么意思| 科员是什么职务| 土地出让是什么意思| 旧历是什么意思| 月经不来是什么原因| au是什么货币| 给花施肥用什么肥料| 靶向治疗是什么意思| 看肠胃挂什么科室| 公共关系是什么意思| 被蜱虫咬了挂什么科| 卤门什么时候闭合| 送孕妇什么礼物最贴心| 淋雨了喝什么驱寒| ny是什么牌子| 梦到别人结婚是什么意思| 荷里活什么意思| 肚脐左上方是什么部位| 户籍所在地是指什么| 卤水点豆腐是什么意思| 看书有什么好处| 什么是氮肥| 挺尸 是什么意思| 身上起红疙瘩是什么原因| 载脂蛋白a1偏高是什么原因| 日值四离是什么意思| 肌腱炎有什么症状| 阿胶有什么功效| 梦见鬼是什么预兆| 儿童上火了吃什么降火最快| 耳鸣是什么病引起的| 氯中毒吃什么可以解毒| 冢字的意思是什么| 临字五行属什么| 是什么元素| 铁观音属于什么茶类| 驾驶证扣6分有什么影响| 血燥吃什么药| 美平是什么药| 618是什么节日| 风花雪月下一句是什么| 丹五行属性是什么| 甲亢能吃什么| 打喷嚏流清鼻涕属于什么感冒| 小孩腰疼是什么原因| 为什么嘴唇会发紫| 九牛一毛是什么生肖| 直肠炎是什么原因引起的| 新生儿不睡觉是什么原因| 属虎的生什么属相的宝宝好| 扬字五行属什么| pms是什么| 肚脐眼左右两边疼是什么原因| 回族人为什么不吃猪肉| 冠脉硬化什么意思| 小舌头学名叫什么| 血热吃什么药好得快| metoo是什么意思| 梦见吃豆腐是什么意思| 莴苣是什么| 印度人口什么时候超过中国| 血糖高什么不能吃| 肝早期硬化身体有什么症状| 农历3月12日是什么星座| 红色加黄色是什么颜色| 阴道瘙痒用什么药最好| 尿素氮肌酐比值偏高是什么原因| 做牛排需要什么调料| 早泄吃什么药最好| 下焦不通吃什么中成药| 妄想什么意思| 流产什么样的症状表现| 上课什么坐姿可以瘦腿| 双相情感障碍吃什么药| 小便憋不住是什么原因| 什么是汉服| 梦见手表是什么意思| 盗汗和自汗有什么区别| 铂金是什么颜色| 肌酸激酶偏低说明什么| 长相厮守是什么意思| e6是什么意思| 老虎属于什么科| 捧杀是什么意思| 什么是舒张压和收缩压| 耵聍是什么东西| 大便出油是什么原因| sport什么品牌| 阴道长什么样子| 上不下要念什么| Picu病房是什么意思| 睡觉小腿抽筋是什么原因| 一什么树干| 空调除湿是什么标志| 肺纤维化是什么症状| 齿痕舌是什么原因| 世界上最长的英语单词是什么| 无缘无故头疼是什么原因| 小学生什么时候开学| 肌肤甲错是什么意思| 膝盖积液有什么症状| 亥时右眼跳是什么预兆| a型血和b型血生的孩子是什么血型| 来来来喝完这杯还有三杯是什么歌| 河南属于什么平原| 粉色象征着什么| 王字旁的字与什么有关| 心系是什么意思| 心肌供血不足用什么药| 眼睛为什么不怕冷| 急性荨麻疹是什么原因引起的| 马后面是什么生肖| 新疆是什么地貌| 5月22是什么星座| 凌波仙子是什么花| 横纹肌溶解是什么意思| 小土豆是什么意思| 宫外孕做什么手术| 卵巢囊肿有什么症状| 血小板压积是什么意思| 20属什么生肖| 动脉斑块是什么意思| 手足口病是什么原因引起的| 藏医最擅长治什么病| 猫来家门口有什么预兆| 周杰伦是什么星座| 梦见钱是什么预兆| 尿检阴性是什么意思| 舒肝健胃丸治什么病| 铁观音茶属于什么茶| 伏地魔是什么意思| 属鼠的幸运色是什么颜色| 区局长是什么级别| 氯雷他定为什么比西替利嗪贵| 女人梦见蛇预示着什么| 大理寺是什么机构| 头伏吃什么| 午餐吃什么好又能减肥| 大悲咒什么意思| 疏肝理气吃什么药| 牙周袋是什么| 护士证什么时候下来| 头晕是什么症状引起的| 脚麻是什么原因引起的| 黄五行属性是什么| 门头是什么意思| 1998年属虎是什么命| 周知是什么意思| 连襟是什么关系| 孙悟空是什么佛| 维c不能和什么一起吃| 穿山甲到底说了什么| 正负得什么| 想字五行属什么| 神经紊乱吃什么药| young是什么意思| 吃黄瓜对身体有什么好处| 心季是什么原因| 鸣是什么家禽| 辟邪剑谱和葵花宝典有什么关系| 肝功能不全是什么意思| 心胸狭窄是什么意思| 后入什么意思| o型血可以接受什么血型| 什么食物含碘| 太古里是什么意思| 左侧卵巢囊性回声是什么意思| 烂大街是什么意思| 情投意合是什么意思| 刺激什么意思| 榴莲什么时间段吃最好| 血府逐瘀片主治什么病| 吃什么上火| cmc是什么| 脖子疼是什么原因| 土界读什么| 2月15日什么星座| 急性肠胃炎应该吃什么药| 睾丸上长毛意味着什么| 小儿感冒吃什么药| 耳朵突然听不见是什么原因| 什么天山| 阴囊潮湿瘙痒是什么原因| 小肚子胀是什么原因| 5.5号是什么星座| 11月出生是什么星座| 耳鸣是什么原因造成的| 乙肝有什么危害| 李逵代表什么生肖| 膳食是什么| 百度 Skip to main content

Object-oriented filesystem paths

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Attention: this backport module isn’t maintained anymore. If you want to report issues or contribute patches, please consider the pathlib2 project instead.

Description

pathlib offers a set of classes to handle filesystem paths. It offers the following advantages over using string objects:

  • No more cumbersome use of os and os.path functions. Everything can be done easily through operators, attribute accesses, and method calls.

  • Embodies the semantics of different path types. For example, comparing Windows paths ignores casing.

  • Well-defined semantics, eliminating any warts or ambiguities (forward vs. backward slashes, etc.).

Requirements

Python 3.2 or later is recommended, but pathlib is also usable with Python 2.7 and 2.6.

Install

In Python 3.4, pathlib is now part of the standard library. For Python 3.3 and earlier, easy_install pathlib or pip install pathlib should do the trick.

Examples

Importing the module classes:

>>> from pathlib import *

Listing Python source files in a directory:

>>> list(p.glob('*.py'))
[PosixPath('test_pathlib.py'), PosixPath('setup.py'),
 PosixPath('pathlib.py')]

Navigating inside a directory tree:

>>> p = Path('/etc')
>>> q = p / 'init.d' / 'reboot'
>>> q
PosixPath('/etc/init.d/reboot')
>>> q.resolve()
PosixPath('/etc/rc.d/init.d/halt')

Querying path properties:

>>> q.exists()
True
>>> q.is_dir()
False

Opening a file:

>>> with q.open() as f: f.readline()
...
'#!/bin/bash\n'

Documentation

The full documentation can be read at Read the Docs.

Contributing

Main development now takes place in the Python standard library: see the Python developer’s guide, and report issues on the Python bug tracker.

However, if you find an issue specific to prior versions of Python (such as 2.7 or 3.2), you can post an issue on the BitBucket project page.

History

Version 1.0.1

  • Pull request #4: Python 2.6 compatibility by eevee.

Version 1.0

This version brings pathlib up to date with the official Python 3.4 release, and also fixes a couple of 2.7-specific issues.

  • Python issue #20765: Add missing documentation for PurePath.with_name() and PurePath.with_suffix().

  • Fix test_mkdir_parents when the working directory has additional bits set (such as the setgid or sticky bits).

  • Python issue #20111: pathlib.Path.with_suffix() now sanity checks the given suffix.

  • Python issue #19918: Fix PurePath.relative_to() under Windows.

  • Python issue #19921: When Path.mkdir() is called with parents=True, any missing parent is created with the default permissions, ignoring the mode argument (mimicking the POSIX “mkdir -p” command).

  • Python issue #19887: Improve the Path.resolve() algorithm to support certain symlink chains.

  • Make pathlib usable under Python 2.7 with unicode pathnames (only pure ASCII, though).

  • Issue #21: fix TypeError under Python 2.7 when using new division.

  • Add tox support for easier testing.

Version 0.97

This version brings pathlib up to date with the final API specified in PEP 428. The changes are too long to list here, it is recommended to read the documentation.

Version 0.8

  • Add PurePath.name and PurePath.anchor.

  • Add Path.owner and Path.group.

  • Add Path.replace().

  • Add Path.as_uri().

  • Issue #10: when creating a file with Path.open(), don’t set the executable bit.

  • Issue #11: fix comparisons with non-Path objects.

Version 0.7

  • Add ‘**’ (recursive) patterns to Path.glob().

  • Fix openat() support after the API refactoring in Python 3.3 beta1.

  • Add a target_is_directory argument to Path.symlink_to()

Version 0.6

  • Add Path.is_file() and Path.is_symlink()

  • Add Path.glob() and Path.rglob()

  • Add PurePath.match()

Version 0.5

  • Add Path.mkdir().

  • Add Python 2.7 compatibility by Michele Lacchia.

  • Make parent() raise ValueError when the level is greater than the path length.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pathlib-1.0.1.tar.gz (49.3 kB view details)

Uploaded Source

Built Distribution

pathlib-1.0.1-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file pathlib-1.0.1.tar.gz.

File metadata

  • Download URL: pathlib-1.0.1.tar.gz
  • Upload date:
  • Size: 49.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pathlib-1.0.1.tar.gz
Algorithm Hash digest
SHA256 6940718dfc3eff4258203ad5021090933e5c04707d5ca8cc9e73c94a7894ea9f
MD5 5099ed48be9b1ee29b31c82819240537
BLAKE2b-256 acaa9b065a76b9af472437a0059f77e8f962fe350438b927cb80184c32f075eb

See more details on using hashes here.

File details

Details for the file pathlib-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pathlib-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for pathlib-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f35f95ab8b0f59e6d354090350b44a80a80635d22efdedfa84c7ad1cf0a74147
MD5 f26b13acf298a15cdb46a3dffc8eb0de
BLAKE2b-256 78f9690a8600b93c332de3ab4a344a4ac34f00c8f104917061f779db6a918ed6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page
未见卵黄囊是什么意思 凌驾是什么意思 吃什么东西能养胃 幻听是什么原因引起的 喜结连理是什么意思
大豆磷脂是什么 什么颜色加什么颜色是紫色 什么是试管婴儿 肌酐高有什么危害 小螃蟹吃什么食物
什么是渡劫 染色体变异发生在什么时期 十点是什么时辰 李逵属什么生肖 外阴瘙痒什么原因引起
什么是用户名 曼字五行属什么 抑郁到什么程度要吃氟西汀 大姨妈喝什么好 阳痿早泄吃什么药好
酱油的原料是什么hcv9jop5ns9r.cn 鬼剃头是因为什么原因引起的0735v.com 股骨头坏死是什么原因引起的hcv8jop1ns2r.cn bmi是什么意思啊hcv8jop0ns5r.cn 埃及的母亲河是什么hcv9jop3ns0r.cn
什么的小毛虫hcv8jop6ns5r.cn 脉弦是什么意思和症状cl108k.com 为什么叫新四军hcv7jop6ns4r.cn 菌丝是什么qingzhougame.com 疑似是什么意思hcv9jop0ns5r.cn
粘米是什么米hcv7jop5ns4r.cn 什么馅饺子好吃inbungee.com 褪黑素有什么用sanhestory.com 筋膜炎吃什么药好得快hcv7jop6ns3r.cn 负离子是什么hcv8jop6ns5r.cn
肝s4钙化灶是什么意思hcv9jop6ns1r.cn 小便带血什么原因hanqikai.com 小狗感冒症状是什么样的hcv9jop3ns0r.cn 跨界是什么意思hcv8jop3ns5r.cn 沛是什么意思clwhiglsz.com
百度