What Is "pathlib" Module

This section describes the 'pathlib' module offers classes representing filesystem paths for different operating systems.

What Is "pathlib" Module? "pathlib" is a Python module that offers classes representing filesystem paths with semantics appropriate for different operating systems.

"pathlib" module offers 2 groups of path classes:

1. Pure paths - Provide purely computational operations without any I/O operations, like manipulating different components of a file path. There are 3 pure path classes:

2. Concrete paths - Extend pure paths to interact actual files pointed by file paths, like creating/deleting files and read/write file contents. There are 3 concrete path classes:

The diagram below shows you relations of "pathlib" (source: python.org):

Python pathlib Module - Class Hierarchy
Python pathlib Module - Class Hierarchy

For more readings on "pathlib", read its manual at https://docs.python.org/3/library/pathlib.html.

Table of Contents

 About This Book

 Running Python Code Online

 Python on macOS Computers

 Python on Linux Computers

 Built-in Data Types

 Variables, Operations and Expressions

 Statements - Execution Units

 Function Statement and Function Call

 Iterators, Generators and List Comprehensions

 Classes and Instances

 Modules and Module Files

 Packages and Package Directories

 "sys" and "os" Modules

"pathlib" - Object-Oriented Filesystem Paths

What Is "pathlib" Module

 "pathlib.Path" - Path for Both Linux and Windows

 "pathlib.Path" - Read and Write Operations

 "pip" - Package Installer for Python

 SciPy.org - Python Libraries for Science

 pandas - Data Analysis and Manipulation

 Anaconda - Python Environment Manager

 Jupyter Notebook and JupyterLab

 References

 Full Version in PDF/EPUB