dimitri> I came up with the following solution: dimitri> a = 'harry is a strange guy. so is his sister, but at least she is not a dimitri> guy. i am.' dimitri> b = a.replace('. ', '.') dimitri> splitlist = b.split('.') dimitri> newlist = [] dimitri> for i in range(len(splitlist)): dimitri> i = ''.join(splitlist[i].capitalize() + '.' dimitri> newlist.append(i) dimitri> cap = ' '.join(newlist).replace(' .', '') dimitri> print cap
No need for the replace(). Just split on ". ". No need for a for loop either, or the temp variable cap. Use a list comprehension. The result is: print ". ".join([s.capitalize() for s in a.split(". ")]) Skip -- http://mail.python.org/mailman/listinfo/python-list