Python making sure x is an int, and not a pesky float
Posted
by Aperture
on Stack Overflow
See other posts from Stack Overflow
or by Aperture
Published on 2010-05-30T15:43:38Z
Indexed on
2010/05/30
15:52 UTC
Read the original article
Hit count: 186
python
For example:
import random
x = random.randint(1, 6)
y = 2
new = x / y
...
now, lets say x turns out to be 5. How can I catch if it's an int or a float before doing other things in my program?
© Stack Overflow or respective owner