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.7.tar.gz
(2.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file IsDigit-0.0.7.tar.gz.
File metadata
- Download URL: IsDigit-0.0.7.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab10e92967e6058741486d71a74b191215170b482a70d7183ff29b63eff983e4
|
|
| MD5 |
9f89b71dbe5d906bd8e6f9debc41ffec
|
|
| BLAKE2b-256 |
54e5c02630a6e0b73fa28ae1822e01f2ec826acf07f37d7b834d12ef16624a6a
|
File details
Details for the file IsDigit-0.0.7-py2-none-any.whl.
File metadata
- Download URL: IsDigit-0.0.7-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c22d6c762b9c17a70bdf537a9f7df5a3def3ea5d07e0d72e165805d653a21c35
|
|
| MD5 |
e1cb6d003fe476189bec723648cd8e5f
|
|
| BLAKE2b-256 |
b52151dbe63308094edae862e69aede2c4ab991d58e317ad02d626a263230c60
|