lists, uppercase?

Magnus Lie Hetland mlh at vier.idi.ntnu.no
Thu Jan 31 16:35:57 EST 2002


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]
>>
>> just two questions this time:
>>
>[list reversal]
>
>> how can i get to know if a string is totally uppercase?
>
>if myString == myString.upper():
>    # it's all upper case
>
>Well, not strictly true: what that tells you is that there are no lower-case
>letters in the string. But
>
>    "123" == "123".upper()
>
>even though there's not an upper case character to be seen. Depends exactly
>what the requirement is, I suspect.

Why not just use the method that's meant for this?

  if myString.isupper():
      # it's all uppercase

>regards
> Steve

--
Magnus Lie Hetland                                  The Anygui Project
http://hetland.org                                  http://anygui.org



More information about the Python-list mailing list