Вы можете использовать косвенное утверждение в сочетании с re.sub()
:
import re
s = ' I love cats'
re.sub(r'''^ # match beginning of string
\s+ # match one or more instances of whitespace
(?=[A-Z]) # positive lookahead assertion of an uppercase character
''','',s,flags=re.VERBOSE)
и показать, что пробел не удален перед строчной буквой :
s = ' this is a test'
re.sub(r'^\s+(?=[A-Z])','',s)
Результат:
' this is a test'