Op 2005-12-21, Steven D'Aprano schreef <[EMAIL PROTECTED]>: > On Wed, 21 Dec 2005 03:37:27 -0800, Neuruss wrote: > >> Can't we just check if the string has digits? > > Why would you want to? > > >> For example: >> >>>>> x = '15' >>>>> if x.isdigit(): >> print int(x)*3 > > 15 is not a digit. 1 is a digit. 5 is a digit. Putting them together to > make 15 is not a digit.
So? the isdigit method tests whether all characters are digits. >>> '15'.isdigit() True -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list