Python Forum
'True' if 'string' has at least one uppercase letter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'True' if 'string' has at least one uppercase letter
#1
Hello,

Do you have any suggestions on how to code: 'True' if 'string' has at least one uppercase letter, e.g. if 'maTh' then 'True'. I can't seem to find anything helpful considering string methods alone.

Thanks
Reply
#2
>>> foo = 'maTh'
>>> any(ch.isupper() for ch in foo)
True
>>> foo = 'math'
>>> any(ch.isupper() for ch in foo)
False
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  AttributeError: module 'string' has no attribute 'uppercase' Anldra12 10 10,242 Apr-23-2021, 05:30 PM
Last Post: ibreeden
  Python uppercase conversion conditions Jaypeng 7 2,955 Apr-29-2020, 11:24 AM
Last Post: jefsummers
  I want to filter out words with one letter in a string (pig latin translator) po0te 1 2,096 Jan-08-2020, 08:02 AM
Last Post: perfringo
  macron on top of uppercase letters newbieAuggie2019 3 3,693 Aug-21-2019, 08:06 PM
Last Post: newbieAuggie2019
  Returning True or False vs. True or None trevorkavanaugh 6 9,228 Apr-04-2019, 08:42 AM
Last Post: DeaD_EyE
  Replace changing string including uppercase character with lowercase character silfer 11 6,161 Mar-25-2019, 12:54 PM
Last Post: silfer
  Replacing all letters in a string apart from the first letter in each word Carbonix 9 4,916 Jan-17-2019, 09:29 AM
Last Post: buran
  Creating list out of the first letter of every word in a string Drone4four 5 31,045 Oct-05-2018, 09:42 PM
Last Post: volcano63
  check if value of passed variable has uppercase characters in it. wfsteadman 3 3,230 Sep-01-2017, 05:52 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020