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.3.tar.gz (2.3 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for numbers_extractor-0.2.3.tar.gz
Algorithm Hash digest
SHA256 4bcdb9f67295395865adfb8df47ad623449113e81b3f75b8e24a0b3babd079f0
MD5 42cc3629df371aec2d0408fc2f462213
BLAKE2b-256 609aa9a51c7213099d2fef7c92978592833696c5c7d49fa3e6ee8b2ef0241df7

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