change the first character of the line to uppercase in a text file
Piet van Oostrum
piet at cs.uu.nl
Sat Jun 27 19:55:17 CEST 2009
>>>>> Terry Reedy <tjreedy at udel.edu> (TR) wrote:
>TR> 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:
>TR> Except possibly for the last line.
But then that line wouldn't be empty either.
If there is an empty line not terminated by a newline after the last
newline, then that is called 'end-of-file' :=)
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org
More information about the Python-list