Python: Split a string at uppercase letters
Write a Python program to split a string into uppercase letters.
Sample Solution:
Python Code:
import re
text = "PythonTutorialAndExercises"
print(re.findall('[A-Z][^A-Z]*', text))
Sample Output:
['Python', 'Tutorial', 'And', 'Exercises']
Pictorial Presentation:
Flowchart:
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Python program to find urls in a string.
Next: Write a Python program to do a case-insensitive string replacement.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics