Dustan wrote:
> Ola K wrote:
> > Hi,
> > I am pretty new to Python and I want to make a script that will search
> > for the following options:
> > 1) words made of uppercase characters -only- (like "YES")
> > 2) words made of lowercase character -only- (like "yes")
> > 3) and words with only the first letter capitalized (like "Yes")
> > * and I need to do all these considering the fact that not all letters
> > are indeed English letters.
> >
> > I went through different documention section but couldn't find a right
> > condition, function or method for it.
> > Suggestions will be very much appriciated...
> > --Ola
>
> I'm not sure exactly what you mean by "considering the fact that not
> all letters are indeed English letters"; you could mean you don't care
> about the non-english characters, or you could mean you don't want any
> non-english characters at all (so the function should return False in
> that case). If the case is the former, there's a simple test for each:
>
> >>> word = 'hi'
> >>> word.upper() == word # evaluates to True if the word is all caps
> False
> >>> word.lower() == word # evaluates to True if the word is all lowercase
> True
> >>> word.title() == word # evaluates to True if the word is in a title format
> False
> >>>

If you're using google groups, it for some reason thought my example
code was 'quoted text', which it certainly isn't, seeing as it's not
found anywhere prior to my message.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to