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

Angus Rodgers twirlip at
Sat Jun 27 06:54:43 EDT 2009

On Sat, 27 Jun 2009 11:39:28 +0100, I asked rhetorically:

>On Fri, 26 Jun 2009 18:58:27 -0700 (PDT), powah
><wong_powah at> wrote:
>>Thank you for your hint.
>>This is my solution:
>>f = open('test', 'r')
>>for line in f:
>>    print line[0].upper()+line[1:],
>Will your program handle empty lines of input correctly?

Strangely enough, it seems to do so, but why?
Angus Rodgers

More information about the Python-list mailing list