Skip to main content

Simple, mainly useless, python package that checks if a string, int, or float is a digit.

Project description

Installing

From source:

  • pip install git+https://github.com/editid0/IsDigit

From pypi:

  • pip install -U IsDigit

Examples

from isdigit import IsDigit

digits = IsDigit(allow_floats=True, allow_ints=True)

print(digits.is_digit('1')) # returns True
print(digits.is_digit('1.0')) # returns True
print(digits.is_digit('1.0.0')) # returns False
print(digits.is_digit('x')) # returns False

Or, alternatively:

from isdigit import IsDigit

digits = IsDigit()

print(digits.is_digit('1')) # returns True
print(digits.is_digit('1.0')) # returns False
print(digits.is_digit('1.0.0')) # returns False
print(digits.is_digit('x')) # returns False

Using discord.py with IsDigit


Install


pip install

pip install -U IsDigit[discord]

Install from repo

pip install git+https://github.com/editid0/IsDigit[discord]

Basic Usage

Please do not use this code when making a bot. Read the discord.py docs instead.
This package is not affiliated with the discord.py library.
from isdigit import IsDigit
from discord.ext import commands

bot = commands.Bot(command_prefix='prefix')
digits = IsDigit()

@bot.command()
async def test(ctx, arg: digits):
    await ctx.send(type(arg))

@test.error
async def test_error(ctx, error):
    await ctx.send(error)

bot.run('token')

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

IsDigit-0.0.10.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

IsDigit-0.0.10-py2-none-any.whl (3.8 kB view details)

Uploaded Python 2

File details

Details for the file IsDigit-0.0.10.tar.gz.

File metadata

  • Download URL: IsDigit-0.0.10.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for IsDigit-0.0.10.tar.gz
Algorithm Hash digest
SHA256 260368ee7c5618e0278d4391f6938001d8bd8d4827816b03a1ffbdd2b30fc409
MD5 9dd5ba1c4a1acecdcb99ba46f3bbbe72
BLAKE2b-256 0d75e06ef6521d9b4d275819ac0963ce8329486638edb2a690c30709adf055dc

See more details on using hashes here.

File details

Details for the file IsDigit-0.0.10-py2-none-any.whl.

File metadata

  • Download URL: IsDigit-0.0.10-py2-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for IsDigit-0.0.10-py2-none-any.whl
Algorithm Hash digest
SHA256 9af7251f27d02729377fdf7d7361d08c3164bd21a05c240b39972e88259c2d04
MD5 4c5ea64593d44190724d2bf76022c665
BLAKE2b-256 42df4cce1811003e34feacb6410c29db2d46736526948f4465540b93fd583018

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