lists, uppercase?

Peter Hansen peter at engcorp.com
Thu Jan 31 18:04:38 EST 2002


Magnus Lie Hetland wrote:
> 
> In article <Vy_58.60751$8b.2485331 at atlpnn01.usenetserver.com>, Steve
> Holden wrote:
> >"Bjorn Pettersen" <BPettersen at NAREX.com> wrote in message
> >news:mailman.1012427749.9821.python-list at python.org...
> >> From: maximilianscherr [mailto:MaximilianScherr at T-Online.de]
> >
> >> how can i get to know if a string is totally uppercase?
[...]
> Why not just use the method that's meant for this?
> 
>   if myString.isupper():
>       # it's all uppercase

Almost, but not quite:

>From 2.2.6.1 String Methods in the 2.2 documentation:
 isupper() :  Return true if all cased characters in the string are uppercase 
 and there is at least one cased character, false otherwise.

In other words, it is possible for a string to contain characters which are
not uppercase and yet isupper() returns true.  

So it all depends on the real requirement.  What does "totally
uppercase" mean to the OP?

-Peter



More information about the Python-list mailing list