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
File details
Details for the file numbers_extractor-0.2.2.tar.gz
.
File metadata
- Download URL: numbers_extractor-0.2.2.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a81cfc50e730500b440a6e6db1e01ca4fd9798cc962f4534c178a32f58d69637 |
|
MD5 | 6394583e0619ef529823f56a0e553234 |
|
BLAKE2b-256 | 22e1596ea49962df3abf36647d6882114fadccdf72e0b162724f472ee3548934 |