Skip to main content

a Python library to add hyphens in the right place to an ISBN (International Standard Book Number)

Project description

isbn_hyphenate is a Python library to add hyphens in the right place to an ISBN (International Standard Book Number). Example:
>>> import isbn_hyphenate
>>> isbn_hyphenate.hyphenate("9781590593561")

Most libraries for handling ISBNs can not do hyphenation because it requires using a list of prefixes, available from the International ISBN Agency.

isbn_hyphenate can handle both 10 and 13 digit ISBNs, and will keep the number of digits. If the ISBN is malformed (wrong length or invalid characters) an IsbnMalformedError exception is raised. If the correct hyphen positions cannot be determined, an IsbnUnableToHyphenateError exception is raised. This can mean that the input ISBN is wrong, or it is in a range that is not yet in the known list.

isbn_hyphenate is compatible with both Python 2 and 3.

To update the prefix list:
  1. Download a new RangeMessage.xml file from
  2. Convert it to Python format: ./ RangeMessage.xml >
These alternative Python libraries can also hyphenate:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for isbn_hyphenate, version 1.0.4
Filename, size File type Python version Upload date Hashes
Filename, size isbn_hyphenate-1.0.4.tar.gz (11.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page