Python Validation: How to Check If a String Is an Integer

preview_player
Показать описание
Python Validation: How to Check If a String is an Integer

Greetings, in this Python tutorial we shall be checking if a string is a valid integer. This validation will also allow for negative integers, for example -5 would be considered valid. 22 and 0 would also be considered valid. 2.2 and -4.20 would be invalid as they are not integers. This is great if you want to ensure your user inputs only an integer.

You can also remove the check for a - symbol if you only want the user to input a postive integer/whole number.

Thanks for watching this Python integer validation tutorial.

Python Validation: How to Check If a String is an Integer
Рекомендации по теме