stdnum.issn

ISSN (International Standard Serial Number).

The ISSN (International Standard Serial Number) is the standard code to identify periodical publications (e.g. magazines).

An ISSN has 8 digits and is formatted in two pairs of 4 digits separated by a hyphen. The last digit is a check digit and may be 0-9 or X (similar to ISBN-10).

More information:

>>> validate('0024-9319')
'00249319'
>>> validate('0032147X')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('003214712')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> compact('0032-1478')
'00321478'
>>> format('00249319')
'0024-9319'
>>> to_ean('0264-3596')
'9770264359008'
stdnum.issn.calc_check_digit(number: str) str

Calculate the ISSN check digit for 8-digit numbers. The number passed should not have the check digit included.

stdnum.issn.compact(number: str) str

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

stdnum.issn.format(number: str) str

Reformat the number to the standard presentation format.

stdnum.issn.is_valid(number: str) bool

Check if the number provided is a valid ISSN.

stdnum.issn.to_ean(number: str, issue_code: str = '00') str

Convert the number to EAN-13 format.

stdnum.issn.validate(number: str) str

Check if the number is a valid ISSN. This checks the length and whether the check digit is correct.