[Tutor] unicode: alpha, whitespaces and digits

Ulrich Goebel ml at fam-goebel.de
Sun Dec 29 14:36:32 CET 2013


Hallo,

I have a unicode string s, for example u"abc", u"äöü", u"123" or 
something else, and I have to find out wether

1. s is not empty and contains only digits (as in u"123", but not in 
u"3.1415")

or

2. s is empty or contains only whitespaces

For all other cases I would assume a "normal" unicode string in s, 
whatever that may be.

For the first case it could be s.isdigit(), s.isnumeric() or 
s.isdecimal() - but which one is the best?

For the second case it should be s.isspace(), but it works only on 
strings, not on unicode strings?

Many thanks for any help!

Ulrich


-- 
Ulrich Goebel
Paracelsusstr. 120, 53177 Bonn


More information about the Tutor mailing list