Price Parser

0.5.1 · active · verified Wed Apr 15

Price-parser is a lightweight Python library designed for robustly extracting price amounts and currency symbols from raw text strings. It intelligently handles various international formats for decimal and thousand separators, making it particularly useful for cleaning price data obtained from web scraping. The library returns a `Price` object containing the numeric amount (as a `Decimal`) and the detected currency. The current version is 0.5.1, released on March 19, 2026, and it maintains an active development and release cadence.

Warnings

Install

Imports

Quickstart

Demonstrates basic price and currency extraction using `Price.fromstring()`, handling various formats, applying currency hints, and explicitly setting the decimal separator. It also shows how to access both Decimal and float representations of the amount.

from price_parser import Price

# Basic usage
price = Price.fromstring("22,90 €")
print(f"Amount: {price.amount}, Currency: {price.currency}")

# Handling different formats
price2 = Price.fromstring("Price: $119.00")
print(f"Amount: {price2.amount}, Currency: {price2.currency}")

# Using currency hints
price3 = Price.fromstring("34.99", currency_hint="руб. (шт)")
print(f"Amount: {price3.amount}, Currency: {price3.currency}")

# Explicitly setting decimal separator
price4 = Price.fromstring("1.234,56 SEK", decimal_separator=",")
print(f"Amount: {price4.amount}, Currency: {price4.currency}")

# Accessing float value (use with caution for financial calculations)
price5 = Price.fromstring("€123.45")
print(f"Float Amount: {price5.amount_float}")

view raw JSON →