Help in string.digits functions

Anoop anoopsanthosh at gmail.com
Tue Jul 25 01:19:53 EDT 2006


Hi All

I am getting two different outputs when i do an operation using
string.digits and test.isdigit(). Is there any difference between the
two. I have given the sample program and the output

Thanks for ur inputs

Anoop

#1:
~~
import string

test='121206'

if test not in string.digits:
    print "I am Not Digit"
else:
    print "I am Digit"

#2:
~~
import string

test='121206'

if not test.isdigit():
    print "I am Not Digit"
else:
    print "I am Digit"

Output
~~~~~
#1:I am Not Digit
#2:I am Digit

Thnks and Rgds 

Anoop




More information about the Python-list mailing list