stdnum.ismn

ISMN (International Standard Music Number).

The ISMN (International Standard Music Number) is used to identify sheet music. This module handles both numbers in the 10-digit 13-digit format.

>>> validate('979-0-3452-4680-5')
'9790345246805'
>>> validate('9790060115615')
'9790060115615'
>>> ismn_type(' M-2306-7118-7')
'ISMN10'
>>> validate('9790060115614')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> compact('  979-0-3452-4680-5')
'9790345246805'
>>> format('9790060115615')
'979-0-060-11561-5'
>>> format('M230671187')
'979-0-2306-7118-7'
>>> to_ismn13('M230671187')
'9790230671187'
stdnum.ismn.compact(number)

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

stdnum.ismn.format(number, separator='-')

Reformat the passed number to the standard format with the prefixes, the publisher element, the item element and the check-digit separated by the specified separator. The number is converted to the 13-digit format silently.

stdnum.ismn.is_valid(number)

Checks to see if the number provided is a valid ISMN (either a legacy 10-digit one or a 13-digit one). This checks the length and the check bit but does not check if the publisher is known.

stdnum.ismn.ismn_type(number)

Check the type of ISMN number passed and return ‘ISMN13’, ‘ISMN10’ or None (for invalid).

stdnum.ismn.split(number)

Split the specified ISMN into a bookland prefix (979), an ISMN prefix (0), a publisher element (3 to 7 digits), an item element (2 to 6 digits) and a check digit.

stdnum.ismn.to_ismn13(number)

Convert the number to ISMN13 (EAN) format.

stdnum.ismn.validate(number)

Checks to see if the number provided is a valid ISMN (either a legacy 10-digit one or a 13-digit one). This checks the length and the check bit but does not check if the publisher is known.

Previous topic

stdnum.isil

Next topic

stdnum.issn