On Mon, 21 Jan 2013 11:02:10 -0600, kwakukwatiah wrote:

> f = open(r'c:\text\somefile.txt')
> for i in range(3):
>        print str(i) + ': ' + f.readline(),
>
> please with the print str(i) + ‘: ‘ + f.readline(), 
> why not print str(i) + f.readline(),


Because the output will be different. The first code will print:

0: first line
1: second line
2: third line


The second code will print:

0first line
1second line
2third line


You should really try these things and see what they do before asking.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to