stdnum.ean

EAN (International Article Number).

Module for handling EAN (International Article Number) codes. This module handles numbers EAN-13, EAN-8, UPC (12-digit) and GTIN (EAN-14) format.

>>> validate('73513537')
'73513537'
>>> validate('978-0-471-11709-4') # EAN-13 format
'9780471117094'
>>> validate('98412345678908') # GTIN format
'98412345678908'
stdnum.ean.calc_check_digit(number)

Calculate the EAN check digit for 13-digit numbers. The number passed should not have the check bit included.

stdnum.ean.compact(number)

Convert the EAN to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.ean.is_valid(number)

Check if the number provided is a valid EAN-13. This checks the length and the check bit but does not check whether a known GS1 Prefix and company identifier are referenced.

stdnum.ean.validate(number)

Check if the number provided is a valid EAN-13. This checks the length and the check bit but does not check whether a known GS1 Prefix and company identifier are referenced.