Python Professional — Hard
Key points
- __fspath__ enables custom objects to act as file paths
- os.fspath() retrieves the string or bytes representation
- Custom classes can define __fspath__
- os.fspath() is not limited to internal use
Ready to go further?
Related questions
