first I know this is the correct method to read and print a file:

fd = open("/etc/sysctl.conf")
done=0
while not done:
    line = fd.readline()
    if line == '':
        done = 1
    else:
        print line,

fd.close()


I dont like that flag of "done",then I tried to re-write it as:

fd = open("/etc/sysctl.conf")
while line = fd.readline():
    print line,
fd.close()


this can't work.why?
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to