Python - how to count number of uppercase letters in a string that is in a list -


For example, if I have this list:

  s = ["Johnny and How can I calculate the number of uppercase letters in each element of this list of Python? "Annie", "great job people", "he and me"]  

For this example, the Python 2, 1, 2 should be returned.

This is my code so far:

  def poisci_pare (besedilo): x = [] seznam = [] T = re.split ("[.]", Besedilo) for e: x = x + e.split () in s: if s == s.capitalize () and s.startswith ('' '): Seznam.append (s)  

This function creates a list where it separates sentences from dots and then filters all uppercase words into it, but I do not know how to calculate uppercase letters.

Try it out:

 < 

For this output Oga:

  [sum] [2, 1, 2]  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -