You need to strip the string and call the title method, here is a simplified method assuming you do not want to keep the whitespaces.
s = "\n\n\n\n first letter is to be capital"
sTitle = s.strip()
print(sTitle.title()) #First Letter Is To Be Capital