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")
'978-1-59059-356-1'

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.

To update the prefix list: 1. Download a new RangeMessage.xml file from http://www.isbn-international.org/agency?rmxml=1 2. Convert it to Python format: ./isbn_xml2py.py RangeMessage.xml > isbn_lengthmaps.py

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.

Source Distribution

isbn_hyphenate-1.0.1.tar.gz (10.2 kB view details)

Uploaded Source

File details

Details for the file isbn_hyphenate-1.0.1.tar.gz.

File metadata

File hashes

Hashes for isbn_hyphenate-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ede53efe60a126187f238cafe6d78344adf3ee9b1fcd6c0be483bc3b173a2a7c
MD5 ef23a37cab7c141f40f92b7bf9900edd
BLAKE2b-256 e80e51aabfb9821c6af976e997370f61e8961673190acfcb25ad535a4111b87a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page