file IO

Read and write files from code: text and binary, reading lines, copying, temp files, and streams, with tested examples and real output.

Python: File Handling, Reading and Writing Text Files

Close a program and everything it computed vanishes with it: every variable, every user entry, gone. Python file handling is how a program remembers, by writing data to disk and reading it back on the next run. This guide covers reading, writing, and appending text files with the with statement, plus the mode and encoding choices that quietly decide whether your data survives. “Make it work, make it right, make it fast.” Kent Beck, TDD By Example Last Updated: July ... Read More

Groovy TimeCategory and Date Manipulation – Cookbook with 10+ Examples

Groovy TimeCategory and date manipulation with 13 tested examples. Write 3.days.ago, 2.hours.from.now, and natural date arithmetic using Groovy’s built-in date DSL and GDK extensions. “There are only two hard things in computer science: cache invalidation and naming things.” Phil Karlton Last Updated: July 2026 | Tested on: Groovy 5.0.6, Java 17+ | Difficulty: Beginner-Intermediate | Reading Time: 18 minutes Our Groovy Date and Time post covers the java.time API – LocalDate, ZonedDateTime, Duration, and the modern approach to dates. This ... Read More

Groovy Property Files – Read, Write, and Manage Config with 10 Tested Examples

Working with Groovy property files is simple. See 10 tested examples to read, write, merge properties, use defaults, and convert between formats on Groovy 5.0.6. “Configuration is the soul of every application. Get it wrong and nothing works. Get it right and nobody notices.” Last Updated: July 2026 | Tested on: Groovy 5.0.6, Java 17+ | Difficulty: Beginner to Intermediate | Reading Time: 14 minutes Every application needs configuration. Database URLs, API keys, feature flags, environment-specific settings – they all ... Read More