A Python library for parsing and validating UK postcodes. Supports all common format types including inward/outward codes, GiroBank, BFPO, and special postcodes. Version 1.1.2 is current; the library is stable and receives infrequent updates.
pip install ukpostcodeparserVerified import paths — ran on the pinned version, not inferred.
Parse a UK postcode into its outward and inward components.
Replace `validate_uk_postcode(p)` with `parse_uk_postcode(p) is not None`.
Test with your expected input formats and validate using the parsed components if strict adherence to a specific format is needed.
Use the parsed postcode with an external validation service (e.g., Ordnance Survey API) for existence checks.
Run `pip install ukpostcodeparser` in the correct Python environment.
Use `parse_uk_postcode` instead of `validate`. Check return value for None to indicate invalid postcode.
Pass a string argument, e.g., `parse_uk_postcode('M1 1AE')`.No dependency data recorded yet.