Hello!<br>
<br>
I want to capitalize every sentence in a string:<br>
harry is a strange guy. so is his sister, but at least she is not a guy. i am.<br>
to:<br>
Harry is a strange guy. So is his sister, but at least she is not a guy. I am.<br>
<br>
I came up with the following solution:<br>
a = 'harry is a strange guy. so is his sister, but at least she is not a guy. i am.'<br>
b = a.replace('. ', '.')<br>
splitlist = b.split('.')<br>
newlist = []<br>
for i in range(len(splitlist)):<br>
i = ''.join(splitlist[i].capitalize() + '.'<br>
newlist.append(i)<br>
cap = ' '.join(newlist).replace(' .', '')<br>
print cap<br>
<br>
and it prints : Harry is a strange guy. So is his sister, but at least she is not a guy. I am.<br>
<br>
But I wonder if there is a easier way to accomplish this. For instance it doesn't work with:<br>
is harry a strange guy? so is his sister, but at least she is not a guy. i am.<br>
<br>
any suggestions?<br>
<br>
Thanks,<br>Dimitri<br>-- <br>Please visit dimitri's website: <a href="http://www.serpia.com">www.serpia.com</a>