Python: Split a string at uppercase letters
Python Regular Expression: Exercise-43 with Solution
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.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/python-exercises/re/python-re-exercise-43.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics