Message279719
>>> from pathlib import Path
>>> p = Path('/foo/bar')
>>> Path('/foo') in p.parents
True
>>> Path('/spam') in p.parents
False
>>> p.parts[:2] == ('/', 'foo')
True
>>> p.parts[:2] == ('/', 'spam')
False
>>> p.relative_to('/foo')
PosixPath('bar')
>>> p.relative_to('/spam')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.5/pathlib.py", line 864, in relative_to
.format(str(self), str(formatted)))
ValueError: '/foo/bar' does not start with '/spam' |
|
Date |
User |
Action |
Args |
2016-10-30 10:03:25 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, pitrou, SilentGhost, cool-RR |
2016-10-30 10:03:25 | serhiy.storchaka | set | messageid: <1477821805.31.0.76401446098.issue28560@psf.upfronthosting.co.za> |
2016-10-30 10:03:25 | serhiy.storchaka | link | issue28560 messages |
2016-10-30 10:03:25 | serhiy.storchaka | create | |
|