title: Splitting on group of capital letters in python
body: <p>I'm trying to tokenize a number of strings using a capital letter as a delimited. I have landed on the following code:</p>
  
  <pre><code>token = ([a for a in re.split(r'([A-Z][a-z]*)', "ABCowDog") if a])
  
  print token
  </code></pre>
  
  <p>And I get this, as expected, in return:</p>
  
  <blockquote>
    <p>['A', 'B', 'Cow', 'Dog']</p>
  </blockquote>
  
  <p>Now, this is just an example string to make life easier, but in my case I want to go through this list and find individual characters (easy enough with checking len()) and putting the individual letters together, provided they meet a prior definition. In the example above the strings 'AB', 'Cow', and 'Dog' are the strings I actually want to form (consecutive capitals are part of an acronym). For whatever reason, once I have my token, I am unable to figure out how to walk the list. Sorry if this is a simple answer, but I'm fairly new to python and am sick of banging my head against the wall.</p>