Back
How do I check whether a variable is an integer?
To check whether a variable is an integer or not you need to do this, do:-
isinstance(<var>, int)
If you are using Python 2.x in which case you want to do something like as follows:-
isinstance(<var>, (int, long))
31k questions
32.8k answers
501 comments
693 users