On Sun, Dec 29, 2013 at 5:58 PM, Steven D'Aprano <[email protected]> wrote:
> If you want to test for something that a human reader will recognise as
> a "whole number", s.isdigit() is probably the best one to use.
isdigit() includes decimal digits plus other characters that have a digit value:
>>> print u'\N{superscript two}'
²
>>> unicodedata.digit(u'\N{superscript two}')
2
However, int(u'\N{superscript two}') raises a ValueError. int() only
accepts the subset of digits that are isdecimal().
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor