Arthur de Jong

Open Source / Free Software developer

About python-stdnum

This is a Python library that aims to provide functions to handle, parse and validate standard numbers.

The module supports more than 200 different number formats amongst which a great number of VAT and other tax numbers, personal identity and company identification codes, international standard numbers (ISBN, IBAN, EAN, etc.) and various other formats.
The module also includes implementations of the Verhoeff, Luhn and the family of ISO/IEC 7064 check digit algorithms.


The following validates and formats an ISBN:

>>> from stdnum import isbn
>>> isbn.validate('978-9024538270')
'9789024538270'
>>> isbn.validate('978-9024538271')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> isbn.format('9780471117094')
'978-0-471-11709-4'

Feedback and support for more numbers is more than welcome. Please use the python-stdnum-users mailing list.

Download

Git repository

The python-stdnum development repository is also available through Git with:

git clone https://arthurdejong.org/git/python-stdnum
The repository is browsable and also cloned from Github.

Copyright notice

Copyright © 2010-2024 Arthur de Jong and others

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU Lesser General Public License for more details.

A copy of the GNU Lesser General Public License is available in the download and can be found on the World Wide Web at http://www.gnu.org/licenses/lgpl.html. You can also obtain it by writing to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.