How to check if a character is upper-case in Python?

前端 未结 7 676
挽巷
挽巷 2020-12-08 09:18

I have a string like this

>>> x=\"Alpha_beta_Gamma\"
>>> words = [y for y in x.split(\'_\')]
>>> words
[\'Alpha\', \'beta\', \'Gam         


        
相关标签:
7条回答
  • 2020-12-08 09:47

    To test that all words start with an upper case use this:

    print all(word[0].isupper() for word in words)
    
    0 讨论(0)
提交回复
热议问题