A
A
Artem Kondratsky2019-06-23 16:46:54
Python
Artem Kondratsky, 2019-06-23 16:46:54

How to do data type checking?

I have an input and it should only receive int data type. If you entered not int, then he should ask you to enter int data.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Borisov, 2019-06-23
@kondrackii

int - 4 bytes, positive value. If stupid, then (<=0 and lenght(input operand) > 4), where lenght is the byte count function.

S
sound901, 2019-06-23
@saund901

isdigit()

int(input())

O
OnYourLips, 2019-06-23
@OnYourLips

You invited me as a tag expert (which is strange, not my area)
But I know the answer: the validator depends on your library or framework.
For Flask: flask.pocoo.org/docs/1.0/patterns/wtforms
For Django: https://docs.djangoproject.com/en/2.2/ref/forms/va...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question