mapping the read() fonction

Andrew Dalke dalke at acm.org
Mon Jul 24 21:08:28 EDT 2000


Grant Edwards wrote:
>How about:
>
>  names = ['a','b','c']
>  list1 = map(open,names,['r','r','r'])
>  print list1
>  list2 = map(lambda f: f.read(), list1)
>  print list2

You probably shouldn't do it that way since with enough names you
might run out of available file descriptors (eg, 64 on the box where
I first ran into the problem :)

                    Andrew
                    dalke at acm.org






More information about the Python-list mailing list