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

import isdigit as id

digits = id.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:

import isdigit as id

digits = id.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.6.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.6-py2-none-any.whl (3.7 kB view details)

Uploaded Python 2

File details

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

File metadata

  • Download URL: IsDigit-0.0.6.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.6.tar.gz
Algorithm Hash digest
SHA256 0cd1529225db7c4adb0aafd6474cd35b5ad4399f1366fd7d3c1d4d1e945e18ca
MD5 fe6a6aa17059b7c0d08a1e7823ed0e28
BLAKE2b-256 56e618a889cbe78b902358b82c9887f909704da7dd1b85cf78e5d205444da801

See more details on using hashes here.

File details

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

File metadata

  • Download URL: IsDigit-0.0.6-py2-none-any.whl
  • Upload date:
  • Size: 3.7 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.6-py2-none-any.whl
Algorithm Hash digest
SHA256 cec55a088b0f01c712335201d124dde458973b1653415c32628937b71897e2a9
MD5 cf4495f4ae4162dc285b6a18b404bc53
BLAKE2b-256 8eacb34c875e385ec9d42d2b9433e3e65d1c436c5806f14be1f3e67c3ee16667

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