Reference library

Automation & scripting

CLI tools, scheduled jobs, filesystem tasks, and glue scripts that save time.

2 matches
Automation & scripting medium

Build an RSS feed from markdown blog posts in Python

Scans a folder of markdown files, extracts titles, dates, and excerpts, and generates a valid RSS 2.0 XML feed.

rss markdown xml
Python
import re
from pathlib import Path
from xml.etree.ElementTree import Element, SubElement, tostring
from datetime import datetime, timezone
from xml.dom import minidom

def build_rss(blog_dir, site_url="https://example.com"):
    feed = Element("rss", version="2.0")
    channel = SubElement(feed, "channel")
    SubElem…
11 0 Open
Automation & scripting medium

Convert DOCX to Text by Unzipping XML in Python

Extract plain text from a .docx file by unzipping the container and parsing word/document.xml with regex, using only Python's standard library.

docx zipfile xml
Python
import zipfile
import re
from pathlib import Path

def docx_to_text_unzip_xml(docx_path: str) -> str:
    """Extract plain text from a .docx file by unzipping and parsing document.xml."""
    docx_path = Path(docx_path)
    if not docx_path.exists():
        raise FileNotFoundError(f"File not found: {docx_path}")

   …
12 0 Open

Browse by section

Each section groups closely related Python snippets.

Automation & scripting — Python code examples

What you will find here

This page collects automation & scripting snippets — short, copy-ready Python you can paste into our free online IDE and run without installing anything. Each sample includes a plain-English explanation and the full source code.

Samples vs tutorials and challenges

Samples are quick reference — one concept per page. For step-by-step teaching, use our Python tutorials. To test yourself, try quizzes or coding challenges. Clean up style with the Python formatter.