I noticed that it is possible to write this :
"""
file('/tmp/myfile', 'w').write('Hello world\n')
contnt = file('/tmp/sourcefile').read()
"""

instead of :
"""
fh = file('/tmp/myfile', 'w')
fh.write('Hello world\n')
fh.close()

fh = file('/tmp/sourcefile')
contnt = fh.read()
fh.close()
"""

is there a reason not to use the first example ?

K.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to