'True' if 'string' has at least one uppercase letter - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: 'True' if 'string' has at least one uppercase letter (/thread-16437.html) |
'True' if 'string' has at least one uppercase letter - ClassicalSoul - Feb-28-2019 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 RE: 'True' if 'string' has at least one uppercase letter - buran - Feb-28-2019 >>> foo = 'maTh' >>> any(ch.isupper() for ch in foo) True >>> foo = 'math' >>> any(ch.isupper() for ch in foo) False |