Skip to main content

Extract numbers from a string and return a list of int.

Project description

Extract numbers from a string and return a list of int.

Install

pip install numbers_extractor

or

easy_install numbers_extractor

Usage

numbers_extractor(string[, multiple=True])

string must be a text that contains zero, one or # numbers. If multiple is set to True (default) return a list of # numbers that can be empty if no numbers are found. If False, return the first number found, or None.

Example:

>>> from numbers_extractor import numbers_extractor
>>> numbers_extractor("20 is 10 plus 10")
[20, 10, 10]
>>> numbers_extractor("20 is 10 plus 10", multiple=False)
20
>>> numbers_extractor("no numbers here")
[]
>>> numbers_extractor("no numbers here", multiple=False)
>>>

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

numbers_extractor-0.2.2.tar.gz (2.3 kB view details)

Uploaded Source

File details

Details for the file numbers_extractor-0.2.2.tar.gz.

File metadata

File hashes

Hashes for numbers_extractor-0.2.2.tar.gz
Algorithm Hash digest
SHA256 a81cfc50e730500b440a6e6db1e01ca4fd9798cc962f4534c178a32f58d69637
MD5 6394583e0619ef529823f56a0e553234
BLAKE2b-256 22e1596ea49962df3abf36647d6882114fadccdf72e0b162724f472ee3548934

See more details on using hashes here.

Supported by

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