Bottom Page

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

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.

>>> foo = 'maTh'
>>> any(ch.isupper() for ch in foo)
>>> foo = 'math'
>>> any(ch.isupper() for ch in foo)

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  if cond1 or cond2 or ...condN is not True asheru93 4 146 Jun-03-2019, 04:24 PM
Last Post: buran
  Returning True or False vs. True or None trevorkavanaugh 6 236 Apr-04-2019, 08:42 AM
Last Post: DeaD_EyE
  str in str == True speedskis777 7 327 Mar-27-2019, 12:15 PM
Last Post: snippsat
  Replace changing string including uppercase character with lowercase character silfer 11 379 Mar-25-2019, 12:54 PM
Last Post: silfer
  file.write stops while true loop from executing in python3 boonr 3 180 Mar-25-2019, 12:50 PM
Last Post: ichabod801
  How to make loop go back to the beginning if test evaluaes to True. FWendeburg 1 189 Feb-13-2019, 01:26 AM
Last Post: stullis
  Replacing all letters in a string apart from the first letter in each word Carbonix 9 467 Jan-17-2019, 09:29 AM
Last Post: buran
  os.path.isdir(<whatever>) returns always True Fabrizio 3 423 Dec-04-2018, 04:28 PM
Last Post: nilamo
  Returning true or false in a for loop bbop1232012 3 312 Nov-22-2018, 04:44 PM
Last Post: bbop1232012
  Creating list out of the first letter of every word in a string Drone4four 5 1,013 Oct-05-2018, 09:42 PM
Last Post: volcano63

Forum Jump:

Users browsing this thread: 1 Guest(s)