Bottom Page

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
Quote
#2
>>> foo = 'maTh'
>>> any(ch.isupper() for ch in foo)
True
>>> foo = 'math'
>>> any(ch.isupper() for ch in foo)
False
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  macron on top of uppercase letters newbieAuggie2019 3 303 Aug-21-2019, 08:06 PM
Last Post: newbieAuggie2019
  Returning True or False vs. True or None trevorkavanaugh 6 434 Apr-04-2019, 08:42 AM
Last Post: DeaD_EyE
  Replace changing string including uppercase character with lowercase character silfer 11 648 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 749 Jan-17-2019, 09:29 AM
Last Post: buran
  Creating list out of the first letter of every word in a string Drone4four 5 2,828 Oct-05-2018, 09:42 PM
Last Post: volcano63
  check if value of passed variable has uppercase characters in it. wfsteadman 3 860 Sep-01-2017, 05:52 PM
Last Post: metulburr

Forum Jump:


Users browsing this thread: 1 Guest(s)