On Tue, May 31, 2011 at 5:23 PM, Hans Barkei <[email protected]> wrote:

> I want to make  a program that finds all the prime numbers up to a number
> inputed by the user.
> I want to know if it is an integer because that will tell me if it is
> divisible by that number or not.
>                          *  ---------Hans-----*
>
> _______________________________________________
> Tutor maillist  -  [email protected]
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
http://stackoverflow.com/questions/1265665/python-check-if-a-string-represents-an-int-without-using-try-except

def RepresentsInt(s):
    try:
        int(s)
        return True
    except ValueError:
        return False

>>> print RepresentsInt("+123")
True
>>> print RepresentsInt("10.0")
False



-- 
Joel Goldstick
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to