On Sat, 27 Jun 2009 11:54:43 +0100
Angus Rodgers <twir...@bigfoot.com> wrote:
> On Sat, 27 Jun 2009 11:39:28 +0100, I asked rhetorically:
> >>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?

The clue is the comma at the end of the print statement.  It is there
because no lines are empty.  They have at least a newline.

-- 
D'Arcy J.M. Cain <da...@druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to