Check if all characters of a string are uppercase

前端 未结 5 963
遥遥无期
遥遥无期 2021-01-03 23:21

Say I have a string that can contain different characters:

e.g. word = "UPPER£CASe"

How would I test the string to see if all the charac

5条回答
  •  耶瑟儿~
    2021-01-04 00:04

    Here you can find a very useful way to check if there's at least one upper or lower letter in a string

    Here's a brief example of what I found in this link:

    print(any(l.isupper() for l in palabra))
    

    https://www.w3resource.com/python-exercises/python-basic-exercise-128.php

提交回复
热议问题