
Security News
GitHub Actions Pricing Whiplash: Self-Hosted Actions Billing Change Postponed
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.
extract-numbers
Advanced tools
Extract numbers from strings with support for commas, decimals, negatives, and the European format.
Extract numbers from strings, with support for commas, decimals, negatives, and the European format.
pip install extract-numbers
from extract_numbers import ExtractNumbers
extractor = ExtractNumbers()
text = "100,000 results found"
extractor.extractNumbers(text)
# => ['100,000']
Create a new extractor instance with optional config.
Extracts all valid numbers from the given string, based on the configured options.
extractor = ExtractNumbers()
extractor.extractNumbers("3030 results found")
# => ['3030']
extractor.extractNumbers("50 out of 100")
# => ['50', '100']
extractor.extractNumbers("Temperature: -15°C, yesterday: -22, before: -20.5")
# => ['-15', '-22', '-20.5']
extractor.extractNumbers("-170,000, -222,987 and -222,987,899.70 respectively.")
# => ['-170,000', '-222,987', '-222,987,899.70']
extractor.extractNumbers("100,000 out of 220,000,000 people")
# => ['100,000', '220,000,000']
extractor.extractNumbers("Your rating is 8.7")
# => ['8.7']
extractor.extractNumbers("Your balance: $100,000.77, previous: $90,899.89")
# => ['100,000.77', '90,899.89']
Type: Object
Type: bool
Default: True
If set to False, all numbers are returned as int or float types.
ExtractNumbers({ 'as_string': False }).extractNumbers("7.7, 3030, 90,899,232.89 and -222,987,899.9")
# => [7.7, 3030, 90899232.89, -222987899.9]
Type: bool
Default: False
Works only when as_string=True.
Removes thousands separators from the returned number strings.
ExtractNumbers({ 'remove_commas': True }).extractNumbers("100,000,000 and -222,987,899.9")
# => ['100000000', '-222987899.9']
Type: bool
Default: False
Works only when as_string=True.
Enables European number formatting (e.g., 1.000.000,99 instead of 1,000,000.99).
ExtractNumbers({ 'european_format': True }).extractNumbers("1.000.000,77")
# => ['1.000.000,77']
ExtractNumbers({ 'european_format': True, 'as_string': False }).extractNumbers("1.000.000,77")
# => [1000000.77]
With remove_commas=True:
ExtractNumbers({ 'european_format': True, 'remove_commas': True }).extractNumbers("1.000.000,77")
# => ['1000000,77']
💡 Note: The decimal comma is preserved for
as_string=Trueto support formatting needs. Useas_string=Falseto convert to a float.
Contributions, issues, and feature requests are welcome!
Feel free to:
If you're fixing a bug or adding a feature, please include a clear description in your PR.
Ensure your changes are covered by tests.
Install dev dependencies:
pip install .[dev]
OR
pip install '.[dev]'
Run the full validation suite (formatting, type checking, and tests):
make validate
MIT © Talha Awan
FAQs
Extract numbers from strings with support for commas, decimals, negatives, and the European format.
We found that extract-numbers demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.