Tagged articles
pathlib
24 articles · Page 1 of 1
The article presents eight practical Python techniques—from using python -m to avoid import errors, leveraging rich for better debugging output, pathlib for path handling, dataclasses to reduce boilerplate, enumerate, proper __main__ guard, perf_counter for benchmarking, and watchdog for hot-reloading—each with code examples, showing how they cut down repetitive tasks and improve productivity.
DebuggingPythonWatchdog
0 likes · 13 min read

This article presents eight practical Python techniques—from using python -m to avoid import errors, to pathlib for path handling, dataclasses for boilerplate reduction, rich for pretty debugging, enumerate, proper __main__ guards, perf_counter for accurate timing, and watchdog for hot‑reloading—each designed to eliminate daily friction and boost development efficiency.
PythonWatchdogdataclasses
0 likes · 14 min read

The article presents seven powerful Python standard‑library features—generators for lazy evaluation, defaultdict for concise counting, pathlib for robust path handling, functools.partial for quick function specialization, itertools for flattening nested loops, type for dynamic class creation, and decorators for reusable logic—showing how each reduces memory usage, simplifies code, and improves automation.
Pythondecoratorsdefaultdict
0 likes · 7 min read

This article showcases six powerful yet often overlooked Python standard‑library features—pathlib, contextlib, __slots__, functools.lru_cache, generator pipelines, and dataclasses—demonstrating how they simplify code, boost performance, reduce memory usage, and make scripts more maintainable.
LRU cachePython__slots__
0 likes · 11 min read

Learn how Python’s modern pathlib module transforms messy file‑system tasks into elegant, cross‑platform code by replacing os.path strings with object‑oriented paths, covering core concepts, essential operations, automation scripts, and best‑practice tips for safer, more readable file handling.
Pythonautomationcross-platform
0 likes · 11 min read

The article walks through five Python libraries—tqdm, Joblib, Pathlib, Cachetools, and Hydra—showing how each can turn buggy, slow, or hard‑to‑manage scripts into clearer, faster, and more maintainable code with concrete examples.
HydraPythoncachetools
0 likes · 5 min read

This article explains how to work with file and directory paths in Python, covering absolute and relative path concepts, the os.path module functions, the modern pathlib API, common operations such as joining, normalizing, traversing, and creating files and directories, and best practices for cross‑platform compatibility.
File PathsPythoncross-platform
0 likes · 8 min read

This article provides a comprehensive guide to Python's path manipulation tools, covering the os.path module functions, the object‑oriented pathlib API, file‑matching with glob, and advanced file operations using shutil, complete with code examples and usage recommendations.
Pythonfile-systemglob
0 likes · 17 min read

This article demonstrates how to use Python's os, os.path, pathlib, and tempfile modules to retrieve the current working directory, list and manipulate files and directories, construct and normalize paths, and create temporary files and directories, providing clear code examples for each operation.
file-handlingos-modulepathlib
0 likes · 6 min read

This article provides a thorough tutorial on Python file handling, covering how to open and close files, read and write data, work with absolute and relative paths, use different file modes, copy files, manipulate CSV files, and serialize data with JSON and pickle modules.
CSVJSONPickle
0 likes · 19 min read

This article introduces nine powerful Python standard library modules that enhance code efficiency and readability, covering context management, iterators, concurrency, file operations, functional programming, AST parsing, type hints, data classes, and async programming.
ASTPythonasyncio
0 likes · 4 min read

This guide explains why pathlib outperforms os.path, shows how to create Path objects, inspect their attributes, manipulate paths, perform file and directory operations, traverse directories, and use advanced features like symlinks and glob patterns, all with clear code examples.
Backendfile-systempath-handling
0 likes · 5 min read

This article introduces ten Python libraries—including os, pathlib, shutil, glob, zipfile, tarfile, csv, json, configparser, and logging—that simplify file handling tasks such as checking existence, reading, writing, copying, compressing, and logging, and provides clear code examples for each.
CSVLibrariesfile-operations
0 likes · 6 min read

This article reviews recent Python standard‑library enhancements, showing how pathlib replaces os.path, secrets supersedes os.urandom, zoneinfo replaces pytz, dataclasses improve on namedtuple, proper logging outperforms print, f‑strings beat format, tomllib replaces tomli, and setuptools supersedes distutils, with code examples for each.
LoggingPythondataclasses
0 likes · 13 min read

This article reviews the most useful additions to the Python standard library—Pathlib, Secrets, Zoneinfo, Dataclasses, proper logging, f‑strings, Tomllib and Setuptools—explaining why they replace older modules, showing concise code examples, and offering guidance on adopting them in everyday projects.
LoggingPythondataclasses
0 likes · 14 min read

This article reviews several modern Python standard‑library modules—Pathlib, Secrets, ZoneInfo, Dataclasses, proper logging, f‑strings, Tomllib, and Setuptools—explaining why they replace older alternatives and providing concise code examples to help developers adopt best practices and keep their projects up‑to‑date.
Loggingdataclassespathlib
0 likes · 13 min read

This article introduces the most useful additions and modern replacements in recent Python releases—including pathlib, the secrets module, zoneinfo, dataclasses, proper logging, f‑strings, the built‑in tomllib, and the transition from distutils to setuptools—showing why and how to adopt them in everyday code.
LoggingPythondataclasses
0 likes · 15 min read

Learn how to automatically identify and delete duplicate files in Python by first comparing file sizes and then using MD5 hashes, with a concise script that leverages pathlib for path handling and hashlib for checksum calculation, offering a fast, reliable solution for everyday file management tasks.
duplicate filesfile-managementhashlib
0 likes · 8 min read

This article walks through four practical Python approaches—using the OS module, pathlib, shutil, and send2trash—to permanently or safely remove directories on Windows, explaining each method's behavior, required settings, and code examples for reliable folder deletion.
OS modulepathlibsend2trash
0 likes · 6 min read

This article explains the historical reason Windows uses backslashes for paths, why hard‑coding separators causes bugs, and demonstrates how Python's pathlib module provides a clean, cross‑platform solution compared to manual string concatenation or the older os.path utilities.
File PathsPythoncross-platform
0 likes · 8 min read

Python’s pathlib module provides a simple, cross‑platform way to construct and manipulate file paths, eliminating the need for manual slash handling or os.path.join, and offering convenient features such as path arithmetic, file existence checks, and easy conversion between Unix and Windows path formats.
File Pathscodingcross-platform
0 likes · 7 min read

This tutorial covers Python's comprehensive file I/O capabilities, including pathlib and os.path directory operations, tempfile usage, fnmatch pattern matching, open() modes and buffering, reading and writing techniques, fileinput streams, linecache random access, and practical code examples.
BufferingFile I/OPython
0 likes · 23 min read

This guide demonstrates how to verify file and directory existence in Python using the os module, open function with exception handling, and the modern pathlib library, providing clear code snippets and explanations for each method.
Exception HandlingOS modulefile handling
0 likes · 2 min read

This guide explains how to use Python's os module, the open function with exception handling, and the pathlib module to reliably determine whether files or directories exist, and how to handle missing‑file errors in a clean, cross‑platform way.
Exception HandlingOS modulePython
0 likes · 3 min read
