le dahut wrote:
> I noticed that it is possible to write this :
> """
> file('/tmp/myfile', 'w').write('Hello world\n')
ISTM I have had trouble with this. I always explicitly close a file that
is open for writing.
> contnt = file('/tmp/sourcefile').read()
I use this often but never in any kind
"le dahut" <[EMAIL PROTECTED]> wrote
>I noticed that it is possible to write this :
> """
> file('/tmp/myfile', 'w').write('Hello world\n')
> contnt = file('/tmp/sourcefile').read()
> """
Yes, it just creates temporary objects and relies on
garbage collection to close/dispose of them.
> inste
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 ther