--- id: parse version: "1.22.1" license: MIT license_treatment: permissive maintenance: active --- # parse — parse() is the opposite of format() License: permissive · Maintenance: active · Downloads: 18.0M/mo ## What it is and what it does Parse is a string-parsing library that inverts Python's format() function: instead of inserting values into a template, it extracts values from a formatted string using the same template syntax. You define a pattern with placeholders like `{}` or named fields like `{name}`, and parse() returns the matched values as a Result object with both positional and named access. The library supports format specifications for type conversion (integers, floats, dates, hex, binary, and regex character classes), alignment and width handling, and both case-sensitive and case-insensitive matching. It has no external dependencies and is lightweight enough for embedded use in data extraction pipelines, log parsing, or configuration file parsing. Use it for: - Extract fields from log lines or structured text output without regex - Parse configuration files or reports with consistent formatting - Convert formatted strings back to typed Python objects (dates, numbers, etc.) - Build data extraction pipelines where format patterns are more readable than regex - Match and capture groups from text using Python's familiar format syntax ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parse strings using format-string-like patterns to extract structured data, reversing the operation of Python's format() function. Yes. Parse is lightweight, dependency-free, actively maintained, MIT-licensed, and solves a real problem—extracting data from formatted strings is more readable with parse() than with regex for many common cases. No known vulnerabilities. Install it if you need to reverse format() operations or prefer format-string patterns over regex for text extraction. ## Install pip install parse uv add parse poetry add parse ## Installing parse Before you install: Installs cleanly with no runtime dependencies and maintains active status with recent releases. License in practice: MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects. Quickstart: from parse import parse, compile # Simple extraction result = parse("It's {}, I love it!", "It's spam, I love it!") print(result[0]) # 'spam' # Typed extraction result = parse('Age: {:d}', 'Age: 42') print(result[0]) # 42 # Compiled pattern for reuse p = compile("The {} who {}") result = p.parse("The knights who say Ni!") print(result.fixed) # ('knights', 'say') Verify before relying: - Whether the package supports Python 2 despite the wheel name suggesting it (parse-1.22.1-py2.py3-none-any.whl vs requires_python unspecified) ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 18.0M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags string parsing with format patterns, extract data from formatted strings, format string reverse, pattern matching text extraction, parse structured text data, format() opposite, string template matching, string-parsing, data-extraction, text-processing [View on SkillFed](https://skillfed.io/packages/parse) · [View on PyPI](https://pypi.org/project/parse/)