how to add space before capital letter in python

Solutions on MaxInterview for how to add space before capital letter in python by the best coders in the world

showing results for - "how to add space before capital letter in python"
Jasmine
29 Apr 2020
1text = 'WordWordWord'
2new_text = ''
3
4for i, letter in enumerate(text):
5    if i and letter.isupper():
6        new_text += ' '
7
8    new_text += letter
9