change the first character of the line to uppercase in a text file

Terry Reedy tjreedy at udel.edu
Sat Jun 27 13:38:04 EDT 2009


Peter Otten wrote:

>>> Will your program handle empty lines of input correctly?
>> Strangely enough, it seems to do so, but why?
> 
> Because there aren't any. When you read lines from a file there will always 
> be at least the newline character. Otherwise it would indeed fail:

Except possibly for the last line.




More information about the Python-list mailing list