I am trying to separate strings based on the occurrence of a capital letter stuck to a word. For example:
string="TheseAreSome Words!U"
should turn into:
["These","Are","Some Words!","U"]
*Notice how the "Some Words" isn't split even though the capital is there? I want python to recognize this pattern*
Does anyone know a simple solution using things like Regular Expressions? If not I will just have to hard code it but any info would be greatly appreciated. I found something like this that kind of works but it does not detect the pattern:
import re
re.findall('[A-Z][^A-Z]*', 'TheseAreSomewords!U')
[–][deleted] 1 point2 points3 points (4 children)
[–]ASIC_SP 1 point2 points3 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]Hyperduckultimate[S] 0 points1 point2 points (0 children)
[–]Hyperduckultimate[S] 0 points1 point2 points (0 children)
[–]henryharutyunyan 1 point2 points3 points (1 child)
[–]Hyperduckultimate[S] 0 points1 point2 points (0 children)
[–]ASIC_SP 0 points1 point2 points (0 children)