PyDocs

Nav

File and Directory Access

Path.open

pathlib

method of Path (source)
  • Path.open(mode='r', buffering=-1, encoding=None, errors=None, newline=None)
Open the file pointed to by this path and return a file object, as
the built-in open() function does.
1 Example
>>> p = Path('setup.py')
>>> with p.open() as f:
...     f.readline()
...
'#!/usr/bin/env python3\n'
from the Python docs
See Also
No see-alsos for pathlib/Path.open
0 Notes
No notes for Path.open