mirror of
https://github.com/gechandesu/pathstr.git
synced 2026-01-23 13:34:12 +03:00
32 lines
1.6 KiB
Markdown
32 lines
1.6 KiB
Markdown
# Path Manupulations
|
|
|
|
The `pathstr` module is a wrapper around the standard `os` module for working with paths.
|
|
|
|
The idea is to represent a path as a string alias, allowing strings to be cast to paths and
|
|
back, and also transparently using the `Path` type everywhere a string is expected.
|
|
|
|
Corresponding methods:
|
|
|
|
| os function | pathstr alternative |
|
|
| --------------------------- | ------------------------ |
|
|
| `os.join_path()` | `Path.join()` |
|
|
| `os.dir()` | `Path.dir()` |
|
|
| `os.file_name()` | `Path.name()` |
|
|
| `os.file_ext()` | `Path.ext()` |
|
|
| `os.split_path()` | `Path.split()` |
|
|
| `os.expand_tilde_to_home()` | `Path.expand_tilde()` |
|
|
| `os.norm_path()` | `Path.normalized()` |
|
|
| `os.quoted_path()` | `Path.quoted()` |
|
|
| `os.abs_path()` | `Path.abs()` |
|
|
| `os.real_path()` | `Path.real()` |
|
|
| `os.exists()` | `Path.exists()` |
|
|
| `os.existing_path()` | `Path.existing()` |
|
|
| `os.is_abs_path()` | `Path.is_abs()` |
|
|
| `os.is_file()` | `Path.is_file()` |
|
|
| `os.is_link()` | `Path.is_link()` |
|
|
| `os.is_dir()` | `Path.is_dir()` |
|
|
| `os.is_dir_empty()` | `Path.is_dir_empty()` |
|
|
| `os.is_readable()` | `Path.is_readable()` |
|
|
| `os.is_writable()` | `Path.is_writable()` |
|
|
| `os.is_executable()` | `Path.is_executable()` |
|