> Guido's time machine strikes again! It's already in Python
> 3; your
> example would be spelled:
>
> with open('scores.csv') as f, open('grades.csv', wt) as g:
> g.write(f.read())
>
Indeed! Thanks, Chris and James.
Yingjie
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, Nov 1, 2010 at 3:03 PM, Yingjie Lan wrote:
> with open('scores.csv'), open('grades.csv', wt) as f,g:
> g.write(f.read())
One could write their own ContextManager here...
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
--
http://mail.python.org/mailman/listinfo
On Sun, Oct 31, 2010 at 10:03 PM, Yingjie Lan wrote:
> Hi,
>
> Suppose I am working with two files simultaneously,
> it might make sense to do this:
>
> with open('scores.csv'), open('grades.csv', wt) as f,g:
> g.write(f.read())
>
> sure, you can do this with nested with-blocks,
> but the one